feat: add keypad key mappings

This commit is contained in:
Peter Steinberger
2026-01-17 06:22:05 +00:00
parent b31d8d3b10
commit bd32cc40e6
2 changed files with 19 additions and 0 deletions

View File

@@ -14,6 +14,9 @@ test("encodeKeySequence maps common keys and modifiers", () => {
const shiftTab = encodeKeySequence({ keys: ["S-Tab"] });
expect(shiftTab.data).toBe("\x1b[Z");
const kpEnter = encodeKeySequence({ keys: ["KPEnter"] });
expect(kpEnter.data).toBe("\x1bOM");
});
test("encodeKeySequence supports hex + literal with warnings", () => {

View File

@@ -51,6 +51,22 @@ const namedKeyMap = new Map<string, string>([
["f10", `${ESC}[21~`],
["f11", `${ESC}[23~`],
["f12", `${ESC}[24~`],
["kp/", `${ESC}Oo`],
["kp*", `${ESC}Oj`],
["kp-", `${ESC}Om`],
["kp+", `${ESC}Ok`],
["kp7", `${ESC}Ow`],
["kp8", `${ESC}Ox`],
["kp9", `${ESC}Oy`],
["kp4", `${ESC}Ot`],
["kp5", `${ESC}Ou`],
["kp6", `${ESC}Ov`],
["kp1", `${ESC}Oq`],
["kp2", `${ESC}Or`],
["kp3", `${ESC}Os`],
["kp0", `${ESC}Op`],
["kp.", `${ESC}On`],
["kpenter", `${ESC}OM`],
]);
const modifiableNamedKeys = new Set([