factor out term_supported_styles() for use by ncdirect

pull/1693/head
nick black 3 years ago committed by Nick Black
parent e5bc2a7d7f
commit 3f26ff2464

@ -612,7 +612,7 @@ void init_lang(notcurses* nc); // nc may be NULL, only used for logging
// be connected to a terminal device, or -1 if no terminal is available.
int interrogate_terminfo(tinfo* ti, int fd, const char* termname,
unsigned utf8, unsigned noaltscreen);
int term_supported_styles(const tinfo* ti);
int reset_term_attributes(const tinfo* ti, FILE* fp);
void free_terminfo_cache(tinfo* ti);

@ -1617,16 +1617,7 @@ int ncplane_cursor_at(const ncplane* n, nccell* c, char** gclust){
}
unsigned notcurses_supported_styles(const notcurses* nc){
unsigned styles = 0;
styles |= nc->tcache.standout ? NCSTYLE_STANDOUT : 0;
styles |= nc->tcache.uline ? NCSTYLE_UNDERLINE : 0;
styles |= nc->tcache.reverse ? NCSTYLE_REVERSE : 0;
styles |= nc->tcache.blink ? NCSTYLE_BLINK : 0;
styles |= nc->tcache.dim ? NCSTYLE_DIM : 0;
styles |= nc->tcache.bold ? NCSTYLE_BOLD : 0;
styles |= nc->tcache.italics ? NCSTYLE_ITALIC : 0;
styles |= nc->tcache.struck ? NCSTYLE_STRUCK : 0;
return styles;
return term_supported_styles(&nc->tcache);
}
unsigned notcurses_palette_size(const notcurses* nc){

@ -546,3 +546,16 @@ int query_term(tinfo* ti, int fd){
pthread_mutex_unlock(&ti->pixel_query);
return ret;
}
int term_supported_styles(const tinfo* ti){
unsigned styles = 0;
styles |= ti->standout ? NCSTYLE_STANDOUT : 0;
styles |= ti->uline ? NCSTYLE_UNDERLINE : 0;
styles |= ti->reverse ? NCSTYLE_REVERSE : 0;
styles |= ti->blink ? NCSTYLE_BLINK : 0;
styles |= ti->dim ? NCSTYLE_DIM : 0;
styles |= ti->bold ? NCSTYLE_BOLD : 0;
styles |= ti->italics ? NCSTYLE_ITALIC : 0;
styles |= ti->struck ? NCSTYLE_STRUCK : 0;
return styles;
}

Loading…
Cancel
Save