Fix Option key special characters leaking through on hotkey events#178
Fix Option key special characters leaking through on hotkey events#178LekcRg wants to merge 1 commit intokitlangton:mainfrom
Conversation
…y events - Use matchesExactly() instead of == for modifier comparison in .none case to correctly handle side (.either vs .left/.right) during key repeat - Return true in .stopRecording case to consume the event when stopping double-tap lock recording
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe hotkey keyboard handling in the transcription feature was refined: the stopRecording hotkey now returns true to intercept events and prevent Option key character printing, and modifier comparison logic was updated to use a more precise matching method instead of direct equality. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
When using an Option-based hotkey (e.g. ⌥A), macOS would print special
characters like å or © in two scenarios:
Key repeat (autorepeat): While holding the hotkey, repeated keyDown
events were compared using == on Modifiers instead of matchesExactly.
Since the hotkey stores side: .either but the incoming event has side: .left,
the sets were not equal — the event wasn't consumed and the special
character leaked through.
Double-tap lock stop: When pressing the hotkey to stop a double-tap
lock recording session, the handler returned false, not consuming the
event — causing one extra special character to be printed.
Fix
In TranscriptionFeature.swift, the .none case: replace
keyEvent.modifiers == hotKeyProcessor.hotkey.modifierswithkeyEvent.modifiers.matchesExactly(hotKeyProcessor.hotkey.modifiers)to correctly handle side (.either vs .left/.right) comparison during key repeat.
In TranscriptionFeature.swift, the .stopRecording case: return true
instead of false to consume the event when stopping double-tap lock recording.
Summary by CodeRabbit