Skip to content

Fix Option key special characters leaking through on hotkey events#178

Open
LekcRg wants to merge 1 commit intokitlangton:mainfrom
LekcRg:main
Open

Fix Option key special characters leaking through on hotkey events#178
LekcRg wants to merge 1 commit intokitlangton:mainfrom
LekcRg:main

Conversation

@LekcRg
Copy link

@LekcRg LekcRg commented Feb 27, 2026

Problem

When using an Option-based hotkey (e.g. ⌥A), macOS would print special
characters like å or © in two scenarios:

  1. 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.

  2. 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.modifiers with
    keyEvent.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

  • Bug Fixes
    • Fixed hotkey handling during recording to prevent unintended character input from modifier keys.
    • Improved modifier key detection for more precise hotkey recognition.

…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
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f29125d and da148c3.

📒 Files selected for processing (1)
  • Hex/Features/Transcription/TranscriptionFeature.swift

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Hotkey Handling Logic
Hex/Features/Transcription/TranscriptionFeature.swift
Modified stopRecording hotkey to return true instead of false for proper event interception, and updated keyboard modifier comparison from direct equality to precise matching via matchesExactly(...).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A whisker-twitch of keyboard might,
Where modifiers now match just right,
No stray ⌥ symbols need to fear,
The hotkey's grip is crystal clear!
Transcription flows with graceful dance,
A polish born of careful stance.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly and accurately describes the main change: fixing the issue where Option key special characters leak through on hotkey events.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant