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

@@ -145,21 +145,10 @@ static const struct input_kitty_key input_kitty_keys[] = {
{ KEYC_ISO_LEVEL5_SHIFT, 57454, 'u' }
};
static u_int
input_kitty_default_flags(void)
{
if (options_get_number(global_options, "extended-keys") == 2 &&
options_get_number(global_options, "extended-keys-format") ==
EXTENDED_KEYS_KITTY)
return (KITTY_KEY_DISAMBIGUATE);
return (0);
}
void
input_kitty_reset(struct screen *s)
{
memset(&s->kitty_keys, 0, sizeof s->kitty_keys);
s->kitty_keys.flags = input_kitty_default_flags();
}
void
@@ -186,7 +175,6 @@ input_kitty_set(struct screen *s, u_int flags, int mode)
s->kitty_keys.flags &= ~flags;
else
s->kitty_keys.flags = flags;
s->kitty_keys.flags |= input_kitty_default_flags();
}
void
@@ -194,8 +182,7 @@ input_kitty_push(struct screen *s, u_int flags)
{
s->kitty_keys.saved_flags = s->kitty_keys.flags;
s->kitty_keys.have_saved = 1;
s->kitty_keys.flags = (flags & KITTY_KEY_SUPPORTED)|
input_kitty_default_flags();
s->kitty_keys.flags = flags & KITTY_KEY_SUPPORTED;
}
void
@@ -206,9 +193,8 @@ input_kitty_pop(struct screen *s, u_int count)
if (s->kitty_keys.have_saved && count == 1)
s->kitty_keys.flags = s->kitty_keys.saved_flags;
else
s->kitty_keys.flags = input_kitty_default_flags();
s->kitty_keys.flags = 0;
s->kitty_keys.have_saved = 0;
s->kitty_keys.flags |= input_kitty_default_flags();
}
static u_int