diff --git a/tabby-core/src/services/hotkeys.service.ts b/tabby-core/src/services/hotkeys.service.ts index fba550a4..91c2be0f 100644 --- a/tabby-core/src/services/hotkeys.service.ts +++ b/tabby-core/src/services/hotkeys.service.ts @@ -128,7 +128,7 @@ export class HotkeysService { const keyName = getKeyName(eventData) if (eventName === 'keydown') { - this.addPressedKey(eventData) + this.addPressedKey(keyName, eventData) this.shouldSaveNextKeystroke = true this.updateModifiers(eventData) } @@ -272,6 +272,9 @@ export class HotkeysService { if (!event[prop] && this.pressedKeys.has(key)) { this.removePressedKey(key) } + if (event[prop] && !this.pressedKeys.has(key)) { + this.addPressedKey(key, event) + } } } @@ -324,8 +327,7 @@ export class HotkeysService { return keys } - private addPressedKey (eventData: KeyEventData) { - const keyName = getKeyName(eventData) + private addPressedKey (keyName: KeyName, eventData: KeyEventData) { this.pressedKeys.add(keyName) this.pressedKeyTimestamps.set(keyName, eventData.registrationTime) } diff --git a/tabby-settings/src/components/hotkeyInputModal.component.ts b/tabby-settings/src/components/hotkeyInputModal.component.ts index e67baa0f..a9b83a5c 100644 --- a/tabby-settings/src/components/hotkeyInputModal.component.ts +++ b/tabby-settings/src/components/hotkeyInputModal.component.ts @@ -48,12 +48,14 @@ export class HotkeyInputModalComponent extends BaseComponent { ) { super() this.hotkeys.clearCurrentKeystrokes() - this.subscribeUntilDestroyed(hotkeys.keystroke$, (keystroke) => { - this.lastKeyEvent = performance.now() - this.value.push(keystroke) + this.subscribeUntilDestroyed(hotkeys.keyEvent$, event => { event.preventDefault() event.stopPropagation() }) + this.subscribeUntilDestroyed(hotkeys.keystroke$, keystroke => { + this.lastKeyEvent = performance.now() + this.value.push(keystroke) + }) } splitKeys (keys: string): string[] {