Browse Source

Better handling space shortcuts

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/17780/head
Šimon Brandner 11 months ago
parent
commit
f8da8254ce
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
  1. 32
      src/vector/platform/ElectronPlatform.tsx

32
src/vector/platform/ElectronPlatform.tsx

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

Loading…
Cancel
Save