Fix keys getting swallowed when enabling only "Report event types"

Per kovidgoyal/kitty#9999, enabling "Report event types" without
"Disambiguate escape codes" doesn't really make sense, and terminals may
choose whatever behavior they think makes sense. However, keys shouldn't
get swallowed (which, after #5791, happens when the !useCsiU branch
cannot handle the event), so instead make "Report event types" imply
"Disambiguate escape codes".
This commit is contained in:
zeertzjq
2026-05-12 13:41:22 +08:00
parent 7059a07c09
commit 50e90ddf8a
2 changed files with 26 additions and 2 deletions
+4 -1
View File
@@ -485,7 +485,10 @@ export class KittyKeyboard {
const useCsiU = !!(
flags & KittyKeyboardFlags.REPORT_ALL_KEYS_AS_ESCAPE_CODES ||
(reportEventTypes && eventType === KittyKeyboardEventType.RELEASE) ||
(flags & KittyKeyboardFlags.DISAMBIGUATE_ESCAPE_CODES &&
// Enabling REPORT_EVENT_TYPES without DISAMBIGUATE_ESCAPE_CODES doesn't really make sense, so
// just make REPORT_EVENT_TYPES imply DISAMBIGUATE_ESCAPE_CODES here for simplicity.
// See: https://github.com/kovidgoyal/kitty/issues/9999
((flags & KittyKeyboardFlags.DISAMBIGUATE_ESCAPE_CODES || reportEventTypes) &&
(
// Per spec, Enter/Tab/Backspace "still generate the same bytes as in legacy mode" and
// consider space to be a text-generating key, so these skip the isFunc fast-path and only