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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user