Skip to content
Source
Sign inSign up
pingdotgg/t3code

Limit physical key fallback to non-Latin layout output #4469

Mergedyashranaway(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/4469/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 37 additions and 2 deletions.

x
0 of 2 viewed, 2 left
29 additions and 0 deletionsapps/web/src/keybindings.test.tsModified
View file
@@ -712,6 +712,35 @@
"rightPanel.toggle",
});
+​
+ it("matches non-Latin layout letters using the physical key code", () => {
+ const keybindings = compile([{ shortcut: modShortcut("d"), command: "diff.toggle" }]);
+​
+ assert.strictEqual(
+ resolveShortcutCommand(event({ key: "в", code: "KeyD", metaKey: true }), keybindings, {
+ platform: "MacIntel",
+ }),
+ "diff.toggle",
+ );
+ });
+​
+ it("ignores the physical key code when the layout types a different Latin letter", () => {
+ const keybindings = compile([{ shortcut: modShortcut("d"), command: "diff.toggle" }]);
+​
+ // On a remapped layout the physical D key types "a"; only the physical
+ // key whose layout output is "d" may trigger the shortcut.
+ assert.isNull(
+ resolveShortcutCommand(event({ key: "a", code: "KeyD", metaKey: true }), keybindings, {
+ platform: "MacIntel",
+ }),
+ );
+ assert.strictEqual(
+ resolveShortcutCommand(event({ key: "d", code: "KeyL", metaKey: true }), keybindings, {
+ platform: "MacIntel",
+ }),