diff --git a/src/lib/internal.h b/src/lib/internal.h index d415dc67c..c88cc880a 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -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); diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 08f17b06b..a1ffb9a0e 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -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", diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index 035decd52..30673caf5 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -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; } diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index cf5113873..bca482418 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -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