Send kitty keyboard probe only if extended-keys is not off.

This commit is contained in:
Michael Grant
2026-09-29 17:48:26 +01:00
parent 895c9e4b42
commit ff391aa052
7 changed files with 49 additions and 10 deletions

24
tty.c
View File

@@ -404,11 +404,14 @@ tty_start_tty(struct tty *tty)
void
tty_send_requests(struct tty *tty)
{
int ek;
if (~tty->flags & TTY_STARTED)
return;
if (tty->term->flags & TERM_VT100LIKE) {
if (~tty->flags & TTY_HAVEKKB)
ek = options_get_number(global_options, "extended-keys");
if (ek != 0 && (~tty->flags & TTY_HAVEKKB))
tty_puts(tty, "\033[?u");
if (~tty->flags & TTY_HAVEDA)
tty_puts(tty, "\033[c");
@@ -451,6 +454,25 @@ tty_repeat_requests(struct tty *tty, int force)
tty_start_start_timer(tty);
}
/* Ask about Kitty keyboard support if extended-keys was turned on later. */
void
tty_extended_keys_changed(struct tty *tty)
{
if (~tty->flags & TTY_STARTED)
return;
tty_update_features(tty);
if (options_get_number(global_options, "extended-keys") == 0)
return;
if (~tty->term->flags & TERM_VT100LIKE)
return;
if (tty->term->flags & TERM_KITTYKEYS)
return;
tty->flags &= ~TTY_HAVEKKB;
tty_puts(tty, "\033[?u");
tty_start_start_timer(tty);
}
void
tty_stop_tty(struct tty *tty)
{