Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
ignore modifier toggle release after suggestion dismissal
altic-dev2fd507a3b0ea
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swiftindex 052eef81..5cece606 100644--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift@@ -1280,7 +1280,10 @@ final class GlobalHotkeyManager: NSObject {if SettingsStore.shared.cancelRecordingHotkeyShortcut?.matches(keyCode: keyCode, modifiers: eventModifiers) == true {let result = self.cancelCallback?() ?? .unhandled// Closing a suggestion must preserve the held shortcut and capture.- if result == .dismissedOverlay { return nil }+ if result == .dismissedOverlay {+ self.markOtherInputDuringModifierOnly()+ return nil+ }var handled = result == .cancelledif !handled, self.asrService.isRunningOrStarting {Task { @MainActor in await self.asrService.stopWithoutTranscription() }diff --git a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swiftindex 9d223fff..16ea45fd 100644--- a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift+++ b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift@@ -1983,6 +1983,34 @@ final class HotkeyShortcutTests: XCTestCase {}}+ @MainActor+ func testSuggestionDismissalInterruptsModifierOnlyToggleWithoutStartingRecording() async throws {+ let settings = SettingsStore.shared+ let previous = settings.cancelRecordingHotkeyShortcut+ defer { settings.cancelRecordingHotkeyShortcut = previous }+ settings.cancelRecordingHotkeyShortcut = HotkeyShortcut(keyCode: 53, modifierFlags: .option)+ var starts = 0+ let manager = self.makePrimaryReleaseTestManager(asr: ASRService(), onStart: { starts += 1 })+ manager.updatePrimaryShortcuts([HotkeyShortcut(keyCode: 61, modifierFlags: [], modifierKeyCodes: [61])])+ manager.setCancelCallback { .dismissedOverlay }+ let down = try self.primaryReleaseTestEvent(type: .flagsChanged, keyCode: 61, modifiers: .maskAlternate)+ _ = manager.handleKeyEvent(type: .flagsChanged, event: down)+ let escape = try self.primaryReleaseTestEvent(type: .keyDown, keyCode: 53, modifiers: .maskAlternate)+ XCTAssertNil(manager.handleKeyEvent(type: .keyDown, event: escape))+ let up = try self.primaryReleaseTestEvent(type: .flagsChanged, keyCode: 61, modifiers: [])+ _ = manager.handleKeyEvent(type: .flagsChanged, event: up)+ for _ in 0..<20 {+ await Task.yield()+ }+ XCTAssertEqual(starts, 0, "Closing the suggestion must not count as a clean modifier tap")+ _ = manager.handleKeyEvent(type: .flagsChanged, event: down)+ _ = manager.handleKeyEvent(type: .flagsChanged, event: up)+ for _ in 0..<20 {+ await Task.yield()+ }+ XCTAssertEqual(starts, 1, "The next genuine modifier tap must still work")+ }+@MainActorfunc testCancelBeforeToggleReleaseDoesNotNeedApplicationUIToHandleIt() async throws {let settings = SettingsStore.shared