fix(keymap): match remaining letter shortcuts by typed character (#292)

#291 named letter keys by the typed character (e.key) when Alt is not held, so AZERTY Ctrl+Z is no longer Ctrl+W. Hard-coded handlers still compared the physical KeyboardEvent.code. A shared letterOf(e) in platform/keymap.ts now backs strokeOf and those handlers:

- terminal Ctrl+Shift+C / V / T (copy, paste, new tab) and Ctrl+letter control codes
- Run/Debug Configurations Ctrl/Cmd+N
- browser shortcut guards (blocked reload/print etc.)

Alt combos keep the physical key (Option / AltGr type symbols).
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-10-29 23:05:26 +08:00
1 джерело d1a597898d
коміт aeec0e6759
8 files changed
+64 -18

No files matched your search

+4
Переглянути файл
@@ -4,6 +4,7 @@ import {
installKeyboardDispatcher,
isAltGrTyping,
isValidBinding,
letterOf,
normalizeBinding,
parseDoubleModifier,
strokeOf,
@@ -31,6 +32,9 @@ describe("keymap", () => {
it("names letters by the character typed, so AZERTY's Ctrl+Z is not Ctrl+W", () => {
// AZERTY: the key typing "z" is physically KeyW.
expect(letterOf({ code: "KeyW", key: "z", altKey: false })).toBe("Z");
expect(letterOf({ code: "KeyF", key: "ƒ", altKey: true })).toBe("F");
expect(letterOf({ code: "Digit1", key: "1", altKey: false })).toBeNull();
expect(strokeOf({ code: "KeyW", key: "z", metaKey: false, ctrlKey: true, altKey: false, shiftKey: false })).toBe(
"Ctrl+Z",
);