diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 714246e55..b195cecac 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -117,6 +117,7 @@ notcurses_stop_minimal(void* vnc){ } } } + logdebug("reset terminal, returning %d\n", ret); return ret; } diff --git a/src/lib/termdesc.c b/src/lib/termdesc.c index 5460c3f2d..ec3c657a0 100644 --- a/src/lib/termdesc.c +++ b/src/lib/termdesc.c @@ -775,6 +775,7 @@ int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned ut *cursor_x = *cursor_y = -1; memset(ti, 0, sizeof(*ti)); ti->bg_collides_default = 0xfe000000; + ti->kbdlevel = UINT_MAX; // see comment in tinfo definition ti->qterm = TERMINAL_UNKNOWN; // we don't need a controlling tty for everything we do; allow a failure here ti->ttyfd = get_tty_fd(out); @@ -1026,6 +1027,8 @@ int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned ut goto err; } } + }else{ + ti->kbdlevel = 0; // confirmed no support, don't bother popping } if(*cursor_x >= 0 && *cursor_y >= 0){ if(add_u7_escape(ti, &tablelen, &tableused)){ diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index 69ebca857..e0d28551f 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -186,6 +186,12 @@ typedef struct tinfo { HANDLE outhandle; #endif + // kitty keyboard protocol level. we initialize this to UINT_MAX, in case we + // crash while running the initialization automata (in that case, we want to + // pop the keyboard support level, which we normally do only if we detected + // actual support. at that point, we obviously haven't detected anything). + // after getting the initialization package back, if it's still UINT_MAX, we + // set it back to 0, since we know at that point that there's no support. unsigned kbdlevel; // kitty keyboard support level bool bce; // is the bce property advertised? bool in_alt_screen; // are we in the alternate screen?