restore NCSTYLE_BLINK for now, add 25m to turn it off #1818

This commit is contained in:
nick black 2021-06-26 01:14:13 -04:00
parent 8a265920b7
commit 9973788efb
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
8 changed files with 28 additions and 15 deletions

View File

@ -2,7 +2,8 @@ This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.3.7 (not yet released)
* Deprecated `NCSTYLE_REVERSE` and `NCSTYLE_DIM`. The remainder are safe.
* Deprecated `NCSTYLE_REVERSE` and `NCSTYLE_DIM`. The remainder are safe,
and I added back `NCSTYLE_BLINK` according to popular demand.
* Added `NCOPTION_PRESERVE_CURSOR`. If used, the standard plane's virtual
cursor will be initialized to match its position at startup, rather than
starting in the upper-left corner. Together with a scrolling standard

View File

@ -663,19 +663,13 @@ 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);
// FIXME for abi3, flatten these back down and recover the contiguous bits
#define NCSTYLE_MASK 0x07ffu
#define NCSTYLE_UNDERCURL 0x0400u
#define NCSTYLE_STRUCK 0x0200u
#define NCSTYLE_ITALIC 0x0100u
// 0x0080 NCSTYLE_STANDOUT has been deprecated
#define NCSTYLE_UNDERLINE 0x0040u
// 0x0020 NCSTYLE_REVERSE has been deprecated
// 0x0010 NCSTYLE_BLINK has been deprecated
// 0x0008 NCSTYLE_DIM has been deprecated
#define NCSTYLE_MASK 0xffffu
#define NCSTYLE_ITALIC 0x0020u
#define NCSTYLE_UNDERLINE 0x0010u
#define NCSTYLE_UNDERCURL 0x0008u
#define NCSTYLE_BOLD 0x0004u
// 0x0002 NCSTYLE_INVIS has been deprecated
// 0x0001 NCSTYLE_PROTECT has been deprecated
#define NCSTYLE_STRUCK 0x0002u
#define NCSTYLE_BLINK 0x0001u
#define NCSTYLE_NONE 0
// Set the specified style bits for the nccell 'c', whether they're actively
@ -4367,7 +4361,6 @@ API void notcurses_debug_caps(const struct notcurses* nc, FILE* debugfp)
#define CELL_ALPHA_OPAQUE NCALPHA_OPAQUE
#define NCSTYLE_PROTECT 0x0001u
#define NCSTYLE_STANDOUT 0x0080u
#define NCSTYLE_BLINK 0x0010u
#define NCSTYLE_REVERSE 0x0020u
#define NCSTYLE_INVIS 0x0002u
#define NCSTYLE_DIM 0x0008u

View File

@ -169,6 +169,8 @@ static void
tinfo_debug_styles(struct ncplane* n, const char* indent){
ncplane_set_fg_rgb8(n, 0xc8, 0xa2, 0xc8);
ncplane_putstr(n, indent);
tinfo_debug_style(n, "blink", NCSTYLE_BLINK);
ncplane_putchar(n, ' ');
tinfo_debug_style(n, "bold", NCSTYLE_BOLD);
ncplane_putchar(n, ' ');
tinfo_debug_style(n, "ital", NCSTYLE_ITALIC);

View File

@ -1271,6 +1271,8 @@ coerce_styles(FILE* out, const tinfo* ti, uint16_t* curstyle,
uint16_t newstyle, unsigned* normalized){
*normalized = 0; // we never currently use sgr0
int ret = 0;
ret |= term_setstyle(out, *curstyle, newstyle, NCSTYLE_BLINK,
get_escape(ti, ESCAPE_BLINK), get_escape(ti, ESCAPE_NOBLINK));
ret |= term_setstyle(out, *curstyle, newstyle, NCSTYLE_BOLD,
get_escape(ti, ESCAPE_BOLD), get_escape(ti, ESCAPE_NOBOLD));
ret |= term_setstyle(out, *curstyle, newstyle, NCSTYLE_ITALIC,

View File

@ -390,6 +390,7 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
{ ESCAPE_SITM, "sitm", },
{ ESCAPE_RITM, "ritm", },
{ ESCAPE_BOLD, "bold", },
{ ESCAPE_BLINK, "blink", },
{ ESCAPE_CUD, "cud", },
{ ESCAPE_CUU, "cuu", },
{ ESCAPE_CUF, "cuf", },
@ -467,6 +468,7 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
{ NCSTYLE_UNDERLINE, "smul", A_UNDERLINE },
{ NCSTYLE_ITALIC, "sitm", A_ITALIC },
{ NCSTYLE_STRUCK, "smxx", 0 },
{ NCSTYLE_BLINK, "blink", A_BLINK },
{ 0, NULL, 0 }
};
if(get_escape(ti, ESCAPE_BOLD)){
@ -474,6 +476,11 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
goto err;
}
}
if(get_escape(ti, ESCAPE_BLINK)){
if(grow_esc_table(ti, "\e[25m", ESCAPE_NOBLINK, &tablelen, &tableused)){
goto err;
}
}
const char* sgr = get_escape(ti, ESCAPE_SGR);
int nocolor_stylemask = tigetnum("ncv");
for(typeof(*styles)* s = styles ; s->s ; ++s){

View File

@ -46,6 +46,8 @@ typedef enum {
ESCAPE_CUF, // "cuf" move n cells forward (right)
ESCAPE_BOLD, // "bold" enter bold mode
ESCAPE_NOBOLD, // disable bold (ANSI but not terminfo, SGR 22)
ESCAPE_BLINK, // "blink" enter blink mode
ESCAPE_NOBLINK, // disable blink (ANSI but not terminfo, SGR 25)
ESCAPE_CUD, // "cud" move n cells down
ESCAPE_CUF1, // "cuf1" move 1 cell forward (right)
ESCAPE_SMKX, // "smkx" keypad_xmit (keypad transmit mode)

View File

@ -13,7 +13,7 @@ int main(void){
return EXIT_FAILURE;
}
int e = 0;
for(unsigned i = 0 ; i < (NCSTYLE_UNDERCURL << 1u) ; ++i){
for(unsigned i = 0 ; i < (NCSTYLE_ITALIC << 1u) ; ++i){
if((ncdirect_supported_styles(nc) & i) == i){
if(ncdirect_set_styles(nc, i)){
ncdirect_stop(nc);

View File

@ -18,6 +18,8 @@ int main(void){
// FIXME do full permutations?
ncplane_set_styles(n, NCSTYLE_NONE);
ncplane_putstr_yx(n, y++, 0, "a ═ none");
ncplane_set_styles(n, NCSTYLE_BLINK);
ncplane_putstr_yx(n, y++, 0, "a ═ blink");
ncplane_set_styles(n, NCSTYLE_ITALIC);
ncplane_putstr_yx(n, y++, 0, "a ═ italic");
ncplane_set_styles(n, NCSTYLE_BOLD);
@ -64,6 +66,10 @@ int main(void){
ncplane_putstr_yx(n, y++, 0, "a ═ bold underline italic struck");
ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_UNDERCURL | NCSTYLE_ITALIC | NCSTYLE_STRUCK);
ncplane_putstr_yx(n, y++, 0, "a ═ bold undercurl italic struck");
ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_UNDERLINE | NCSTYLE_ITALIC | NCSTYLE_STRUCK | NCSTYLE_BLINK);
ncplane_putstr_yx(n, y++, 0, "a ═ bold underline italic struck blink");
ncplane_set_styles(n, NCSTYLE_BOLD | NCSTYLE_UNDERCURL | NCSTYLE_ITALIC | NCSTYLE_STRUCK | NCSTYLE_BLINK);
ncplane_putstr_yx(n, y++, 0, "a ═ bold undercurl italic struck blink");
ncplane_set_styles(n, NCSTYLE_NONE);
if(notcurses_render(nc)){