Detection, done like sync:

- ESC[?u goes to every VT100-like terminal at attach, whatever the
  options.
- A reply turns on a new kittykeys terminal feature. Users can force
  it on or off with terminal-features kittykeys, including kittykeys@
  to turn it off.
- Changing extended-keys now takes effect immediately for attached
  clients (options.c).

Use, per client, when extended-keys is on: Kitty for clients that have
kittykeys, modifyOtherKeys for clients with extkeys, VT10x otherwise.

Pane side:

- Applications can request either protocol; Kitty wins if one asks for
  both.
- Each application gets what it asked for, whichever client typed the
  key.
- ESC[?u is answered truthfully.
- The per-client gate is gone. window.c and popup.c are simply
  master's versions again.

extended-keys always is back to its master meaning, forcing
modifyOtherKeys mode 1 only. Forcing Kitty on every program would have
sent bash ESC[97;5u for Ctrl-A.

extended-keys-format kitty is still accepted, but now behaves the same
as csi-u.
This commit is contained in:
Michael Grant
2026-09-19 07:32:57 +01:00
parent 7545954d00
commit d85329e5f0
17 changed files with 117 additions and 212 deletions

View File

@@ -1635,11 +1635,9 @@ format_cb_client_key_mode(struct format_tree *ft)
}
/* This mirrors the choice made in tty_update_features(). */
kitty = ((c->tty.flags & (TTY_HAVEKKB|TTY_KKBSUPPORT)) ==
(TTY_HAVEKKB|TTY_KKBSUPPORT));
kitty = ((c->tty.term->flags & TERM_KITTYKEYS) != 0);
eks = (options_get_number(global_options, "extended-keys") != 0);
if (kitty && options_get_number(global_options,
"extended-keys-format") == EXTENDED_KEYS_KITTY)
if (kitty)
eks = 0;
if (eks && tty_term_has(c->tty.term, TTYC_ENEKS))
mode = "Ext";
@@ -2527,10 +2525,7 @@ format_cb_pane_key_mode(struct format_tree *ft)
char *s;
if (ft->wp != NULL && ft->wp->screen != NULL) {
if (options_get_number(global_options, "extended-keys-format") ==
EXTENDED_KEYS_KITTY) {
if (ft->wp->screen->kitty_keys.flags == 0)
return (xstrdup("VT10x"));
if (ft->wp->screen->kitty_keys.flags != 0) {
xasprintf(&s, "Kitty %u",
ft->wp->screen->kitty_keys.flags);
return (s);