termdesc: set up termversion #1798, print in banners

pull/1802/head
nick black 3 years ago
parent 8d86fd3162
commit ed04cb72c5
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -594,16 +594,8 @@ void sigwinch_handler(int signo);
void init_lang(void);
// load |ti| from the terminfo database, which must already have been
// initialized. set |utf8| if we've verified UTF8 output encoding.
// set |noaltscreen| to inhibit alternate screen detection. |fd| ought
// 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, unsigned nocbreak);
int term_supported_styles(const tinfo* ti);
int reset_term_attributes(const tinfo* ti, FILE* fp);
void free_terminfo_cache(tinfo* ti);
// if there were missing elements we wanted from terminfo, bitch about them here
void warn_terminfo(const notcurses* nc, const tinfo* ti);

@ -876,7 +876,8 @@ init_banner(const notcurses* nc){
char prefixbuf[BPREFIXSTRLEN + 1];
term_fg_palindex(nc, stdout, 50 % nc->tcache.caps.colors);
printf("\n notcurses %s by nick black et al", notcurses_version());
printf(" on %s", nc->tcache.termname ? nc->tcache.termname : "?");
printf(" on %s %s", nc->tcache.termname ? nc->tcache.termname : "?",
nc->tcache.termversion ? nc->tcache.termversion : "");
term_fg_palindex(nc, stdout, 12 % nc->tcache.caps.colors);
if(nc->tcache.cellpixy && nc->tcache.cellpixx){
printf("\n %d rows (%dpx) %d cols (%dpx) (%sB) %zuB crend %d colors",

@ -107,8 +107,9 @@ match_termname(const char* termname, queried_terminals_e* qterm){
}
void free_terminfo_cache(tinfo* ti){
free(ti->esctable);
ncinputlayer_stop(&ti->input);
free(ti->termversion);
free(ti->esctable);
}
// tlen -- size of escape table. tused -- used bytes in same.
@ -505,5 +506,6 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
err:
free(ti->esctable);
free(ti->termversion);
return -1;
}

@ -144,6 +144,7 @@ typedef struct tinfo {
int (*pixel_clear_all)(int fd); // called during startup, kitty only
int sprixel_scale_height; // sprixel must be a multiple of this many rows
const char* termname; // terminal name from environment variables/init
char* termversion; // terminal version (freeform) from query responses
struct termios tpreserved; // terminal state upon entry
ncinputlayer input; // input layer
bool bitmap_supported; // do we support bitmaps (post pixel_query_done)?
@ -170,6 +171,15 @@ term_supported_styles(const tinfo* ti){
return ti->supported_styles;
}
// load |ti| from the terminfo database, which must already have been
// initialized. set |utf8| if we've verified UTF8 output encoding.
// set |noaltscreen| to inhibit alternate screen detection. |fd| ought
// 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, unsigned nocbreak);
void free_terminfo_cache(tinfo* ti);
#ifdef __cplusplus
}
#endif

Loading…
Cancel
Save