native macOS codings agent orchestrator
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf(shortcuts): limit hint mode to bare modifiers

onevcat 0fd3295e bf277695

+11 -5
+2 -1
supacode/App/CommandKeyObserver.swift
··· 50 50 } 51 51 52 52 nonisolated static func shouldShowShortcuts(for modifierFlags: NSEvent.ModifierFlags) -> Bool { 53 - modifierFlags.contains(.command) || modifierFlags.contains(.control) 53 + let modifiers = modifierFlags.intersection(.deviceIndependentFlagsMask) 54 + return modifiers == .command || modifiers == .control 54 55 } 55 56 56 57 private func handleCommandKeyChange(isDown: Bool) {
+9 -4
supacodeTests/CommandKeyObserverTests.swift
··· 4 4 @testable import supacode 5 5 6 6 struct CommandKeyObserverTests { 7 - @Test func shouldShowShortcutsForCommandOrControl() { 7 + @Test func shouldShowShortcutsForBareCommandOrControl() { 8 8 #expect(CommandKeyObserver.shouldShowShortcuts(for: [.command])) 9 9 #expect(CommandKeyObserver.shouldShowShortcuts(for: [.control])) 10 - #expect(CommandKeyObserver.shouldShowShortcuts(for: [.command, .shift])) 11 - #expect(CommandKeyObserver.shouldShowShortcuts(for: [.control, .option])) 10 + } 11 + 12 + @Test func shouldNotShowShortcutsForShortcutCombinations() { 13 + #expect(CommandKeyObserver.shouldShowShortcuts(for: [.command, .shift]) == false) 14 + #expect(CommandKeyObserver.shouldShowShortcuts(for: [.control, .option]) == false) 15 + #expect(CommandKeyObserver.shouldShowShortcuts(for: [.command, .control]) == false) 16 + #expect(CommandKeyObserver.shouldShowShortcuts(for: [.command, .control, .shift]) == false) 12 17 } 13 18 14 - @Test func shouldNotShowShortcutsForOtherModifiers() { 19 + @Test func shouldNotShowShortcutsForNonHintModifiers() { 15 20 #expect(CommandKeyObserver.shouldShowShortcuts(for: []) == false) 16 21 #expect(CommandKeyObserver.shouldShowShortcuts(for: [.shift]) == false) 17 22 #expect(CommandKeyObserver.shouldShowShortcuts(for: [.option]) == false)