Fix space shortcuts on non-English layouts

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-06-25 16:04:12 +02:00
parent 0bf78cd531
commit 76d9f26a16
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -575,9 +575,9 @@ export default class ElectronPlatform extends VectorBasePlatform {
onKeyDown(ev: KeyboardEvent): boolean { onKeyDown(ev: KeyboardEvent): boolean {
let handled = false; let handled = false;
switch (ev.key) { switch (ev.code) {
case Key.SQUARE_BRACKET_LEFT: case "BracketLeft":
case Key.SQUARE_BRACKET_RIGHT: case "BracketRight":
if (isMac && ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey) { if (isMac && ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey) {
this.navigateForwardBack(ev.key === Key.SQUARE_BRACKET_LEFT); this.navigateForwardBack(ev.key === Key.SQUARE_BRACKET_LEFT);
handled = true; handled = true;
@ -592,18 +592,19 @@ export default class ElectronPlatform extends VectorBasePlatform {
} }
break; break;
case "1": case "Digit1":
case "2": case "Digit2":
case "3": case "Digit3":
case "4": case "Digit4":
case "5": case "Digit5":
case "6": case "Digit6":
case "7": case "Digit7":
case "8": case "Digit8":
case "9": case "Digit9":
case "0": case "Digit0":
if (SettingsStore.getValue("feature_spaces") && isOnlyCtrlOrCmdKeyEvent(ev)) { if (SettingsStore.getValue("feature_spaces") && isOnlyCtrlOrCmdKeyEvent(ev)) {
this.navigateToSpace(parseInt(ev.key, 10)); const spaceNumber = ev.code.slice(5); // Cut off the first 5 characters - "Digit"
this.navigateToSpace(parseInt(spaceNumber, 10));
handled = true; handled = true;
} }
break; break;