From 4fc1b4493feeb67aa66bbc61308c1d772b22005a Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 16 Oct 2021 02:32:04 -0400 Subject: [PATCH] stop pushing termtype to interrogate_terminfo --- src/lib/direct.c | 2 +- src/lib/notcurses.c | 2 +- src/lib/termdesc.c | 3 ++- src/lib/termdesc.h | 10 ++++------ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib/direct.c b/src/lib/direct.c index f303a9b32..7c7bb3a78 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -911,7 +911,7 @@ ncdirect* ncdirect_core_init(const char* termtype, FILE* outfp, uint64_t flags){ } int cursor_y = -1; int cursor_x = -1; - if(interrogate_terminfo(&ret->tcache, termtype, ret->ttyfp, utf8, 1, + if(interrogate_terminfo(&ret->tcache, ret->ttyfp, utf8, 1, flags & NCDIRECT_OPTION_INHIBIT_CBREAK, 0, &cursor_y, &cursor_x, &ret->stats, 0, 0, 0, 0, flags & NCDIRECT_OPTION_DRAIN_INPUT)){ diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 3dddd6a9d..8cbb92992 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1079,7 +1079,7 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){ &ret->rstate.logendy : &fakecursory; int* cursorx = opts->flags & NCOPTION_PRESERVE_CURSOR ? &ret->rstate.logendx : &fakecursorx; - if(interrogate_terminfo(&ret->tcache, opts->termtype, ret->ttyfp, utf8, + if(interrogate_terminfo(&ret->tcache, ret->ttyfp, utf8, opts->flags & NCOPTION_NO_ALTERNATE_SCREEN, 0, opts->flags & NCOPTION_NO_FONT_CHANGES, cursory, cursorx, &ret->stats, diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index d823cd2b0..1eaef798b 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -769,11 +769,12 @@ macos_early_matches(void){ // Device Attributes, allowing us to get a negative response if our queries // aren't supported by the terminal. we fire it off early because we have a // full round trip before getting the reply, which is likely to pace init. -int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned utf8, +int interrogate_terminfo(tinfo* ti, FILE* out, unsigned utf8, unsigned noaltscreen, unsigned nocbreak, unsigned nonewfonts, int* cursor_y, int* cursor_x, ncsharedstats* stats, int lmargin, int tmargin, int rmargin, int bmargin, unsigned draininput){ + const char* termtype = getenv("TERM"); int foolcursor_x, foolcursor_y; if(!cursor_x){ cursor_x = &foolcursor_x; diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index 239767bfe..116f7ea8a 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -222,15 +222,13 @@ term_supported_styles(const tinfo* ti){ // prepare |ti| from the terminfo database and other sources. set |utf8| if // we've verified UTF8 output encoding. set |noaltscreen| to inhibit alternate // screen detection. |stats| may be NULL; either way, it will be handed to the -// input layer so that its stats can be recorded. if |termtype| is not NULL, it -// will be used to look up the terminfo database entry; the value of TERM is -// otherwise used. -int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, - unsigned utf8, unsigned noaltscreen, unsigned nocbreak, +// input layer so that its stats can be recorded. +int interrogate_terminfo(tinfo* ti, FILE* out, unsigned utf8, + unsigned noaltscreen, unsigned nocbreak, unsigned nonewfonts, int* cursor_y, int* cursor_x, struct ncsharedstats* stats, int lmargin, int tmargin, int rmargin, int bmargin, unsigned draininput) - __attribute__ ((nonnull (1, 3, 10))); + __attribute__ ((nonnull (1, 2, 9))); void free_terminfo_cache(tinfo* ti);