Follow-up to #5787.
The Kitty keyboard protocol spec requires lock state to be reported in the modifier bits:
shift 0b1 (1), alt 0b10 (2), ctrl 0b100 (4), super 0b1000 (8), hyper 0b10000 (16), meta 0b100000 (32), caps_lock 0b1000000 (64), num_lock 0b10000000 (128)
"if the key is pressed or the lock (for Caps Lock / Num Lock) is enabled, the key event must have the bit for that modifier set."
Currently _encodeModifiers() in src/common/input/KittyKeyboard.ts only reads shiftKey/altKey/ctrlKey/metaKey, so the lock bits are never set.
Kitty reference: key_encoding.c only strips lock bits in pure legacy mode (if (!key_encoding_flags) mods &= ~GLFW_LOCK_MASK); with any protocol flag set, they stay.
Observable effect: CapsLock engaged + Ctrl+F1 should send CSI 1;69P (1+4+64) but currently sends CSI 1;5P (1+4).
Implementation note: Adding lock bits to _encodeModifiers() requires a companion change — the modifiers > 0 check in the DISAMBIGUATE path must be replaced with ev.shiftKey || ev.altKey || ev.ctrlKey || ev.metaKey, otherwise CapsLock on + a would wrongly promote to CSI 97;65u instead of sending A. Spec § Disambiguate escape codes: "Lock modifiers are not reported for text producing keys, to keep them usable in legacy programs." Kitty masks with ~LOCK_MASK at the equivalent check (key_encoding.c#L189).
Follow-up to #5787.
The Kitty keyboard protocol spec requires lock state to be reported in the modifier bits:
Currently
_encodeModifiers()insrc/common/input/KittyKeyboard.tsonly readsshiftKey/altKey/ctrlKey/metaKey, so the lock bits are never set.Kitty reference:
key_encoding.conly strips lock bits in pure legacy mode (if (!key_encoding_flags) mods &= ~GLFW_LOCK_MASK); with any protocol flag set, they stay.Observable effect: CapsLock engaged + Ctrl+F1 should send
CSI 1;69P(1+4+64) but currently sendsCSI 1;5P(1+4).Implementation note: Adding lock bits to
_encodeModifiers()requires a companion change — themodifiers > 0check in the DISAMBIGUATE path must be replaced withev.shiftKey || ev.altKey || ev.ctrlKey || ev.metaKey, otherwiseCapsLock on + awould wrongly promote toCSI 97;65uinstead of sendingA. Spec § Disambiguate escape codes: "Lock modifiers are not reported for text producing keys, to keep them usable in legacy programs." Kitty masks with~LOCK_MASKat the equivalent check (key_encoding.c#L189).