Merge branch 'master' into package_upgrades

This commit is contained in:
Jörg Breitbart
2026-05-21 13:34:12 +02:00
2 changed files with 26 additions and 2 deletions
+22 -1
View File
@@ -478,7 +478,7 @@ describe('KittyKeyboard', () => {
assert.strictEqual(result.key, '\x7f');
});
it('press event explicit :1 when modifiers present', () => {
it('press event when modifiers present', () => {
const result = kitty.evaluate(createEvent({ key: 'a', ctrlKey: true }), flags, KittyKeyboardEventType.PRESS);
assert.strictEqual(result.key, '\x1b[97;5u');
});
@@ -554,6 +554,27 @@ describe('KittyKeyboard', () => {
});
});
// Enabling REPORT_EVENT_TYPES without DISAMBIGUATE_ESCAPE_CODES doesn't really make sense and
// isn't specified in the spec, but press and repeat events shouldn't get swallowed.
describe('REPORT_EVENT_TYPES flag without DISAMBIGUATE_ESCAPE_CODES', () => {
const flags = KittyKeyboardFlags.REPORT_EVENT_TYPES;
it('press event is not swallowed when modifiers present', () => {
const result = kitty.evaluate(createEvent({ key: 'a', ctrlKey: true }), flags, KittyKeyboardEventType.PRESS);
assert.strictEqual(result.key, '\x1b[97;5u');
});
it('repeat event is not swallowed when modifiers present', () => {
const result = kitty.evaluate(createEvent({ key: 'a', ctrlKey: true }), flags, KittyKeyboardEventType.REPEAT);
assert.strictEqual(result.key, '\x1b[97;5:2u');
});
it('release event is reported as CSI u sequence', () => {
const result = kitty.evaluate(createEvent({ key: 'a', ctrlKey: true }), flags, KittyKeyboardEventType.RELEASE);
assert.strictEqual(result.key, '\x1b[97;5:3u');
});
});
describe('modifier-only reporting', () => {
const flags = KittyKeyboardFlags.REPORT_EVENT_TYPES;
+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