Skip to content

Commit 2635fc9

Browse files
authored
Merge pull request #17780 from SimonBrandner/fix/space-shortcut-local/17776
Fix space shortcuts on layouts with non-English keys in the places of numbers
2 parents 8289d69 + 43695fb commit 2635fc9

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

src/vector/platform/ElectronPlatform.tsx

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -589,24 +589,18 @@ export default class ElectronPlatform extends VectorBasePlatform {
589589
handled = true;
590590
}
591591
break;
592+
}
592593

593-
case "1":
594-
case "2":
595-
case "3":
596-
case "4":
597-
case "5":
598-
case "6":
599-
case "7":
600-
case "8":
601-
case "9":
602-
case "0":
603-
// ideally we would use SpaceStore.spacesEnabled here but importing SpaceStore in this platform
604-
// breaks skinning as the platform is instantiated prior to the skin being loaded
605-
if (SettingsStore.getValue("feature_spaces") && isOnlyCtrlOrCmdKeyEvent(ev)) {
606-
this.navigateToSpace(parseInt(ev.key, 10));
607-
handled = true;
608-
}
609-
break;
594+
if (!handled &&
595+
// ideally we would use SpaceStore.spacesEnabled here but importing SpaceStore in this platform
596+
// breaks skinning as the platform is instantiated prior to the skin being loaded
597+
SettingsStore.getValue("feature_spaces") &&
598+
ev.code.startsWith("Digit") &&
599+
isOnlyCtrlOrCmdKeyEvent(ev)
600+
) {
601+
const spaceNumber = ev.code.slice(5); // Cut off the first 5 characters - "Digit"
602+
this.navigateToSpace(parseInt(spaceNumber, 10));
603+
handled = true;
610604
}
611605

612606
return handled;

0 commit comments

Comments
 (0)