| ... | ... | @@ -728,6 +728,35 @@ describe("resolveShortcutCommand", () => { |
| 728 | 728 | "rightPanel.toggle", |
| 729 | 729 | ); |
| 730 | 730 | }); |
| 731 | |
| 732 | it("matches non-Latin layout letters using the physical key code", () => { |
| 733 | const keybindings = compile([{ shortcut: modShortcut("d"), command: "diff.toggle" }]); |
| 734 | |
| 735 | assert.strictEqual( |
| 736 | resolveShortcutCommand(event({ key: "в", code: "KeyD", metaKey: true }), keybindings, { |
| 737 | platform: "MacIntel", |
| 738 | }), |
| 739 | "diff.toggle", |
| 740 | ); |
| 741 | }); |
| 742 | |
| 743 | it("ignores the physical key code when the layout types a different Latin letter", () => { |
| 744 | const keybindings = compile([{ shortcut: modShortcut("d"), command: "diff.toggle" }]); |
| 745 | |
| 746 | // On a remapped layout the physical D key types "a"; only the physical |
| 747 | // key whose layout output is "d" may trigger the shortcut. |
| 748 | assert.isNull( |
| 749 | resolveShortcutCommand(event({ key: "a", code: "KeyD", metaKey: true }), keybindings, { |
| 750 | platform: "MacIntel", |
| 751 | }), |
| 752 | ); |
| 753 | assert.strictEqual( |
| 754 | resolveShortcutCommand(event({ key: "d", code: "KeyL", metaKey: true }), keybindings, { |
| 755 | platform: "MacIntel", |
| 756 | }), |
| 757 | "diff.toggle", |
| 758 | ); |
| 759 | }); |
| 731 | 760 | }); |
| 732 | 761 | |
| 733 | 762 | describe("formatShortcutLabel", () => { |