mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
move blink/dim/reverse/uline/standout to bools #1525
This commit is contained in:
parent
c4e2932c76
commit
3b4057d550
@ -55,11 +55,6 @@ typedef struct tinfo {
|
|||||||
char* cud; // move N cells down
|
char* cud; // move N cells down
|
||||||
char* cuf1; // move 1 cell right
|
char* cuf1; // move 1 cell right
|
||||||
char* home; // home cursor
|
char* home; // home cursor
|
||||||
char* standout; // NCSTYLE_STANDOUT
|
|
||||||
char* uline; // NCSTYLE_UNDERLINK
|
|
||||||
char* reverse; // NCSTYLE_REVERSE
|
|
||||||
char* blink; // NCSTYLE_BLINK
|
|
||||||
char* dim; // NCSTYLE_DIM
|
|
||||||
char* italics; // NCSTYLE_ITALIC
|
char* italics; // NCSTYLE_ITALIC
|
||||||
char* italoff; // NCSTYLE_ITALIC (disable)
|
char* italoff; // NCSTYLE_ITALIC (disable)
|
||||||
char* struck; // NCSTYLE_STRUCK
|
char* struck; // NCSTYLE_STRUCK
|
||||||
@ -117,7 +112,13 @@ typedef struct tinfo {
|
|||||||
bool CCCflag; // "CCC" flag for palette set capability
|
bool CCCflag; // "CCC" flag for palette set capability
|
||||||
bool BCEflag; // "BCE" flag for erases with background color
|
bool BCEflag; // "BCE" flag for erases with background color
|
||||||
bool AMflag; // "AM" flag for automatic movement to next line
|
bool AMflag; // "AM" flag for automatic movement to next line
|
||||||
bool bold; // can we do bold via sgr?
|
// FIXME replace these with a single unsigned bitfield directly returned
|
||||||
|
bool bold; // NCSTYLE_BOLD via sgr?
|
||||||
|
bool standout; // NCSTYLE_STANDOUT via sgr?
|
||||||
|
bool uline; // NCSTYLE_UNDERLINE via sgr?
|
||||||
|
bool reverse; // NCSTYLE_REVERSE via sgr?
|
||||||
|
bool blink; // NCSTYLE_BLINK via sgr?
|
||||||
|
bool dim; // NCSTYLE_DIM via sgr?
|
||||||
|
|
||||||
// assigned based off nl_langinfo() in notcurses_core_init()
|
// assigned based off nl_langinfo() in notcurses_core_init()
|
||||||
bool utf8; // are we using utf-8 encoding, as hoped?
|
bool utf8; // are we using utf-8 encoding, as hoped?
|
||||||
|
@ -149,7 +149,7 @@ grow_esc_table(tinfo* ti, const char* tstr, escape_e esc,
|
|||||||
size_t slen = strlen(tstr) + 1; // count the nul term
|
size_t slen = strlen(tstr) + 1; // count the nul term
|
||||||
if(*tlen - *tused < slen){
|
if(*tlen - *tused < slen){
|
||||||
// guaranteed to give us enough space to add tstr (and then some)
|
// guaranteed to give us enough space to add tstr (and then some)
|
||||||
size_t newsize = *tlen + 4096 + slen;
|
size_t newsize = *tlen + 4020 + slen; // don't pull two pages ideally
|
||||||
char* tmp = realloc(ti->esctable, newsize);
|
char* tmp = realloc(ti->esctable, newsize);
|
||||||
if(tmp == NULL){
|
if(tmp == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
@ -244,18 +244,28 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
terminfostr(&ti->standout, "smso"); // begin standout mode
|
|
||||||
terminfostr(&ti->uline, "smul"); // begin underline mode
|
|
||||||
terminfostr(&ti->reverse, "rev"); // begin reverse video mode
|
|
||||||
terminfostr(&ti->blink, "blink"); // turn on blinking
|
|
||||||
terminfostr(&ti->dim, "dim"); // turn on half-bright mode
|
|
||||||
// we don't actually use the bold capability -- we use sgr exclusively.
|
// we don't actually use the bold capability -- we use sgr exclusively.
|
||||||
// but we use the presence of the bold capability to determine whether
|
// but we use the presence of the bold capability to determine whether
|
||||||
// we think sgr supports bold, which...might be valid? i'm unsure.
|
// we think sgr supports bold, which...might be valid? i'm unsure.
|
||||||
char* bold;
|
char* escstyle;
|
||||||
if(terminfostr(&bold, "bold") == 0){
|
if(terminfostr(&escstyle, "bold") == 0){
|
||||||
ti->bold = true;
|
ti->bold = true;
|
||||||
}
|
}
|
||||||
|
if(terminfostr(&escstyle, "smso") == 0){
|
||||||
|
ti->standout = true;
|
||||||
|
}
|
||||||
|
if(terminfostr(&escstyle, "smul") == 0){
|
||||||
|
ti->uline = true;
|
||||||
|
}
|
||||||
|
if(terminfostr(&escstyle, "rev") == 0){
|
||||||
|
ti->reverse = true;
|
||||||
|
}
|
||||||
|
if(terminfostr(&escstyle, "blink") == 0){
|
||||||
|
ti->blink = true;
|
||||||
|
}
|
||||||
|
if(terminfostr(&escstyle, "dim") == 0){
|
||||||
|
ti->dim = true;
|
||||||
|
}
|
||||||
terminfostr(&ti->italics, "sitm"); // begin italic mode
|
terminfostr(&ti->italics, "sitm"); // begin italic mode
|
||||||
terminfostr(&ti->italoff, "ritm"); // end italic mode
|
terminfostr(&ti->italoff, "ritm"); // end italic mode
|
||||||
terminfostr(&ti->home, "home"); // home the cursor
|
terminfostr(&ti->home, "home"); // home the cursor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user