diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index b4b722ec4..6d83a0c81 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -48,22 +48,21 @@ typedef struct tinfo { uint16_t escindices[ESCAPE_MAX]; // table of 1-biased indices into esctable char* esctable; // packed table of escape sequences 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* 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* cub; // move N cells left char* cuf; // move N cells right char* cud; // move N cells down char* cuf1; // move 1 cell right char* home; // home cursor - char* civis; // hide cursor - char* cnorm; // restore cursor to default state char* standout; // NCSTYLE_STANDOUT char* uline; // NCSTYLE_UNDERLINK char* reverse; // NCSTYLE_REVERSE char* blink; // NCSTYLE_BLINK char* dim; // NCSTYLE_DIM - char* bold; // NCSTYLE_BOLD char* italics; // NCSTYLE_ITALIC char* italoff; // NCSTYLE_ITALIC (disable) char* struck; // NCSTYLE_STRUCK @@ -122,6 +121,7 @@ typedef struct tinfo { bool CCCflag; // "CCC" flag for palette set capability bool BCEflag; // "BCE" flag for erases with background color 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() bool utf8; // are we using utf-8 encoding, as hoped? diff --git a/src/lib/terminfo.c b/src/lib/terminfo.c index defe51f9e..e450ab51e 100644 --- a/src/lib/terminfo.c +++ b/src/lib/terminfo.c @@ -242,7 +242,13 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, terminfostr(&ti->reverse, "rev"); // begin reverse video mode terminfostr(&ti->blink, "blink"); // turn on blinking 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->italoff, "ritm"); // end italic mode terminfostr(&ti->sgr, "sgr"); // define video attributes @@ -277,7 +283,7 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, ti->dim = NULL; } if(nocolor_stylemask & A_BOLD){ - ti->bold = NULL; + ti->bold = false; } if(nocolor_stylemask & A_ITALIC){ ti->italics = NULL;