Skip to content

Commit 019a2bb

Browse files
committed
Fix kitty keyboard "Report event types" behavior not matching spec
According to spec: - The Enter, Tab and Backspace keys will not have release events unless "Report all keys as escape codes" is also set. - Key events that result in text are reported as plain UTF-8 text, so events are not supported for them, unless the application requests "key report" mode. I checked kitty's behavior. While it does report release events for keys that result in text as CSI sequences, press and repeat events for these are reported as plain UTF-8 text. This commit changes Xterm.js to match this behavior.
1 parent 4316263 commit 019a2bb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/common/input/KittyKeyboard.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,12 @@ export class KittyKeyboard {
475475

476476
if (flags & KittyKeyboardFlags.REPORT_ALL_KEYS_AS_ESCAPE_CODES) {
477477
useCsiU = true;
478-
} else if (reportEventTypes) {
478+
} else if (reportEventTypes && eventType === KittyKeyboardEventType.RELEASE) {
479+
// Per spec, Enter/Tab/Backspace will not have release events unless "Report all keys as
480+
// escape codes" (which is handled by the branch above) is also set.
481+
if (keyCode === 13 || keyCode === 9 || keyCode === 127) {
482+
return result;
483+
}
479484
useCsiU = true;
480485
} else if (flags & KittyKeyboardFlags.DISAMBIGUATE_ESCAPE_CODES) {
481486
// Per spec, Enter/Tab/Backspace "still generate the same bytes as in legacy

0 commit comments

Comments
 (0)