terminfo: bold is just a boolean now #1525

This commit is contained in:
nick black 2021-05-26 06:05:43 -04:00 committed by Nick Black
parent 1207765cc8
commit e5bc2a7d7f
2 changed files with 12 additions and 6 deletions

View File

@ -48,22 +48,21 @@ typedef struct tinfo {
uint16_t escindices[ESCAPE_MAX]; // table of 1-biased indices into esctable uint16_t escindices[ESCAPE_MAX]; // table of 1-biased indices into esctable
char* esctable; // packed table of escape sequences char* esctable; // packed table of escape sequences
char* sgr; // set many graphics properties at once char* sgr; // set many graphics properties at once
unsigned colors;// number of colors terminfo reported usable for this screen
char* sgr0; // restore default presentation properties char* sgr0; // restore default presentation properties
char* civis; // hide cursor
char* cnorm; // restore cursor to default state
unsigned colors;// number of colors terminfo reported usable for this screen
char* cuu; // move N cells up char* cuu; // move N cells up
char* cub; // move N cells left char* cub; // move N cells left
char* cuf; // move N cells right char* cuf; // move N cells right
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* civis; // hide cursor
char* cnorm; // restore cursor to default state
char* standout; // NCSTYLE_STANDOUT char* standout; // NCSTYLE_STANDOUT
char* uline; // NCSTYLE_UNDERLINK char* uline; // NCSTYLE_UNDERLINK
char* reverse; // NCSTYLE_REVERSE char* reverse; // NCSTYLE_REVERSE
char* blink; // NCSTYLE_BLINK char* blink; // NCSTYLE_BLINK
char* dim; // NCSTYLE_DIM char* dim; // NCSTYLE_DIM
char* bold; // NCSTYLE_BOLD
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
@ -122,6 +121,7 @@ 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?
// 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?

View File

@ -242,7 +242,13 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname,
terminfostr(&ti->reverse, "rev"); // begin reverse video mode terminfostr(&ti->reverse, "rev"); // begin reverse video mode
terminfostr(&ti->blink, "blink"); // turn on blinking terminfostr(&ti->blink, "blink"); // turn on blinking
terminfostr(&ti->dim, "dim"); // turn on half-bright mode terminfostr(&ti->dim, "dim"); // turn on half-bright mode
terminfostr(&ti->bold, "bold"); // turn on extra-bright mode // we don't actually use the bold capability -- we use sgr exclusively.
// but we use the presence of the bold capability to determine whether
// we think sgr supports bold, which...might be valid? i'm unsure.
char* bold;
if(terminfostr(&bold, "bold") == 0){
ti->bold = 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->sgr, "sgr"); // define video attributes terminfostr(&ti->sgr, "sgr"); // define video attributes
@ -277,7 +283,7 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname,
ti->dim = NULL; ti->dim = NULL;
} }
if(nocolor_stylemask & A_BOLD){ if(nocolor_stylemask & A_BOLD){
ti->bold = NULL; ti->bold = false;
} }
if(nocolor_stylemask & A_ITALIC){ if(nocolor_stylemask & A_ITALIC){
ti->italics = NULL; ti->italics = NULL;