Skip to content

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

reserve saved Command shortcut while disabled

altic-dev4e5aa7ad148c
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 92dac7d3..ef0171f5 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -1201,11 +1201,9 @@ struct ContentView: View {
if self.isPromptModeShortcutEnabled {
configuredShortcuts.append((.secondaryDictation, self.promptModeHotkeyShortcut))
}
- if self.isCommandModeShortcutEnabled, let commandModeHotkeyShortcut = self.commandModeHotkeyShortcut {
- configuredShortcuts.append((.command, commandModeHotkeyShortcut))
- }
let optionalConfiguredShortcuts: [(ShortcutRecordingTarget, HotkeyShortcut?)] = [
(.cancel, self.cancelRecordingHotkeyShortcut),
+ (.command, self.commandModeHotkeyShortcut),
(.pasteLast, self.pasteLastTranscriptionHotkeyShortcut),
]
diff --git a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
index 16ea45fd..0f08c6e9 100644
--- a/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
+++ b/Tests/FluidDictationIntegrationTests/HotkeyShortcutTests.swift
@@ -1153,6 +1153,20 @@ final class HotkeyShortcutTests: XCTestCase {
}
}
+ func testSavedCommandShortcutRemainsReservedWhileDisabled() throws {
+ let root = URL(fileURLWithPath: #filePath).deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()
+ let source = try String(contentsOf: root.appendingPathComponent("Sources/Fluid/ContentView.swift"), encoding: .utf8)
+ let start = try XCTUnwrap(source.range(of: "private func shortcutConflictMessage("))
+ let end = try XCTUnwrap(source.range(of: "private func applyPrimaryDictationShortcut", range: start.upperBound..<source.endIndex))
+ let conflicts = String(source[start.lowerBound..<end.lowerBound])
+ let optional = try XCTUnwrap(conflicts.components(separatedBy: "let optionalConfiguredShortcuts:").last?.components(separatedBy: "for (otherTarget").first)
+ XCTAssertTrue(optional.contains("(.command, self.commandModeHotkeyShortcut)"), "The saved binding must remain reserved when Command Mode is toggled off")
+ XCTAssertFalse(conflicts.contains("if self.isCommandModeShortcutEnabled"))
+ XCTAssertTrue(conflicts.contains("configuredShortcut == shortcut"))
+ XCTAssertTrue(conflicts.contains("shortcut.conflictsWith(configuredShortcut)"))
+ XCTAssertTrue(conflicts.contains("otherTarget != target"), "Editing the Command binding must not conflict with itself")
+ }
+
func testBareKeyPolicyCoversLettersNumbersAndEditingKeysButAllowsPunctuation() {
let letters: [UInt16] = [0, 11, 8, 2, 14, 3, 5, 4, 34, 38, 40, 37, 46, 45, 31, 35, 12, 15, 1, 17, 32, 9, 13, 7, 16, 6]
let digits: [UInt16] = [29, 18, 19, 20, 21, 23, 22, 26, 28, 25, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92]