-
-
Notifications
You must be signed in to change notification settings - Fork 144
notcurses_stop fails to turn off kitty keyboard if support isnt detected during initialization, but kitty keyboard is activated regardless during init #2911
Description
Please include the following data:
export | egrep 'LANG|LC_CTYPE|TERM'
COLORTERM=truecolor
LANG=en_US.UTF-8
TERM=xterm-256color
- notcurses version (available from
notcurses-demo i)
3.0.17 - terminal name + version
alacritty 0.16.1 (42f49eeb)
In notcurses_stop_minimal, KKEYBOARD_POP is not emitted if kbdlevel is 0, i.e. if kitty keyboard support was not detected during initialization.
Lines 154 to 162 in c951e0c
| if(nc->tcache.kbdlevel){ | |
| if(tty_emit(KKEYBOARD_POP, nc->tcache.ttyfd)){ | |
| ret = -1; | |
| } | |
| }else{ | |
| if(tty_emit(XTMODKEYSUNDO, nc->tcache.ttyfd)){ | |
| ret = -1; | |
| } | |
| } |
However during initialization, in send_initial_queries, KKBDENTER is emitted regardless of if support for kitty inputs are detected.
Lines 538 to 543 in c951e0c
| if(!draininput){ | |
| if(blocking_write(fd, KKBDENTER, strlen(KKBDENTER))){ | |
| return -1; | |
| } | |
| total += strlen(KKBDENTER); | |
| } |
When running something using notcurses directly in my terminal, kitty keyboard support is not detected, and upon exit (even when calling stop normally), the terminal gets stuck outputting kitty's special protocol stuff, to the point where the only way to regain control of it (that I know of) is to emit something like tput reset > /dev/pts/N from another terminal.
A minimal example to reproduce this is:
#include "notcurses/notcurses.h"
int main()
{
notcurses_options opt =
{
.flags = NCOPTION_CLI_MODE
| NCOPTION_SUPPRESS_BANNERS,
};
notcurses* nc = notcurses_core_init(&opt, nullptr);
ncplane* std = notcurses_stdplane(nc);
ncplane_printf(std, "hello\n");
return notcurses_stop(nc);
}If I remove the check if (nc->tcache.kbdlevel) from notcurses_stop_minimal and just send the KKEYBOARD_POP anyways, the issue goes away. This also doesn't appear to be an issue if I'm running a notcurses program in something that does handle kitty keyboard stuff (or whatever its doing, i dont really know) like neovim's integrated terminal.
Not certain that this is a bug/oversight, could totally be doing something wrong on my end. Lmk, and thanks for notcurses.