Skip to content

Commit

Permalink
direct mode: support undercurl throughout #1758
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jun 18, 2021
1 parent bbde35b commit ff6da44
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions include/notcurses/notcurses.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,10 @@ API int nccell_duplicate(struct ncplane* n, nccell* targ, const nccell* c);
// Release resources held by the nccell 'c'.
API void nccell_release(struct ncplane* n, nccell* c);

#define NCSTYLE_MASK 0x03ffu
#define NCSTYLE_MASK 0x07ffu
#define NCSTYLE_UNDERCURL 0x0400u
#define NCSTYLE_STRUCK 0x0200u
#define NCSTYLE_ITALIC 0x0100u
#define NCSTYLE_STANDOUT 0x0080u
#define NCSTYLE_UNDERLINE 0x0040u
#define NCSTYLE_REVERSE 0x0020u
Expand All @@ -672,9 +675,6 @@ API void nccell_release(struct ncplane* n, nccell* c);
#define NCSTYLE_BOLD 0x0004u
#define NCSTYLE_INVIS 0x0002u
#define NCSTYLE_PROTECT 0x0001u
#define NCSTYLE_ITALIC 0x0100u
#define NCSTYLE_STRUCK 0x0200u
#define NCSTYLE_UNDERCURL 0x0400u
#define NCSTYLE_NONE 0

// Set the specified style bits for the nccell 'c', whether they're actively
Expand Down
12 changes: 11 additions & 1 deletion src/lib/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ int ncdirect_on_styles(ncdirect* n, unsigned stylebits){
}
if(term_setstyle(n->ttyfp, n->stylemask, stylemask, NCSTYLE_UNDERCURL,
get_escape(&n->tcache, ESCAPE_SMULX),
get_escape(&n->tcache, ESCAPE_RMXX))){
get_escape(&n->tcache, ESCAPE_SMULNOX))){
return -1;
}
n->stylemask = stylemask;
Expand Down Expand Up @@ -951,6 +951,11 @@ int ncdirect_off_styles(ncdirect* n, unsigned stylebits){
get_escape(&n->tcache, ESCAPE_RMXX))){
return -1;
}
if(term_setstyle(n->ttyfp, n->stylemask, stylemask, NCSTYLE_UNDERCURL,
get_escape(&n->tcache, ESCAPE_SMULX),
get_escape(&n->tcache, ESCAPE_SMULNOX))){
return -1;
}
n->stylemask = stylemask;
return 0;
}
Expand Down Expand Up @@ -981,6 +986,11 @@ int ncdirect_set_styles(ncdirect* n, unsigned stylebits){
get_escape(&n->tcache, ESCAPE_RMXX))){
return -1;
}
if(term_setstyle(n->ttyfp, n->stylemask, stylemask, NCSTYLE_UNDERCURL,
get_escape(&n->tcache, ESCAPE_SMULX),
get_escape(&n->tcache, ESCAPE_SMULNOX))){
return -1;
}
n->stylemask = stylemask;
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/lib/termdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ add_smulx_escapes(tinfo* ti, size_t* tablelen, size_t* tableused){
grow_esc_table(ti, "\x1b[4:0m", ESCAPE_SMULNOX, tablelen, tableused)){
return -1;
}
ti->supported_styles |= NCSTYLE_UNDERCURL;
return 0;
}

Expand Down

0 comments on commit ff6da44

Please sign in to comment.