From b664b9eed91ececb2e8c37f6d1f7b8ccc4ac1dd7 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 30 Jan 2022 17:51:21 +0100 Subject: [PATCH] fixed repeated hotkeys canceling themselves - fixes #5406, fixes #4566 --- tabby-core/src/services/hotkeys.service.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tabby-core/src/services/hotkeys.service.ts b/tabby-core/src/services/hotkeys.service.ts index 7c4bcc5c..3e6b1559 100644 --- a/tabby-core/src/services/hotkeys.service.ts +++ b/tabby-core/src/services/hotkeys.service.ts @@ -130,9 +130,7 @@ export class HotkeysService { const keyName = getKeyName(eventData) if (eventName === 'keydown') { this.addPressedKey(keyName, eventData) - if (!nativeEvent.repeat) { - this.recognitionPhase = true - } + this.recognitionPhase = true this.updateModifiers(eventData) } if (eventName === 'keyup') { @@ -158,8 +156,10 @@ export class HotkeysService { const matched = this.matchActiveHotkey() this.zone.run(() => { - if (matched && this.recognitionPhase) { - this.emitHotkeyOn(matched) + if (matched) { + if (this.recognitionPhase) { + this.emitHotkeyOn(matched) + } } else if (this.pressedHotkey) { this.emitHotkeyOff(this.pressedHotkey) } @@ -288,10 +288,9 @@ export class HotkeysService { private emitHotkeyOn (hotkey: string) { if (this.pressedHotkey) { - if (this.pressedHotkey === hotkey) { - return + if (this.pressedHotkey !== hotkey) { + this.emitHotkeyOff(this.pressedHotkey) } - this.emitHotkeyOff(this.pressedHotkey) } if (document.querySelectorAll('input:focus').length === 0) { console.debug('Matched hotkey', hotkey) -- GitLab