fix(macos): let a fresh press finish a lock after a missed key release - #111
Open
AmadeusTwi wants to merge 1 commit into
Open
AmadeusTwi wants to merge 1 commit into
AmadeusTwi wants to merge 1 commit into
Conversation
A double-tap lock captures while the keyboard sits idle, but stale key recovery skipped Locked. If a key pressed during the lock lost its key-up, pressed_keys stayed non-empty, the modifier-only trigger never registered, and Escape (which discards the capture) was the only way out. Run the existing neutral-keyboard recovery for a lock that tracks a held key. It clears the key bookkeeping, keeps the lock, and emits no capture action, so the next shortcut press finishes the dictation normally.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HEX version
2.1.22, installed from the signed DMG
Platform
macOS
System details
macOS 15.8 (24H23), MacBook Pro M4 Pro, 24 GB
What happened?
About once every 5–10 dictations, a locked dictation stops responding to the shortcut. I press Right Option to finish and nothing happens, the HUD just keeps recording. The only way out is Escape, which throws the whole recording away. I've lost a few long dictations this way, the longest was about 7 minutes.
Expected: pressing the shortcut again finishes and transcribes, like it does the rest of the time.
Steps to reproduce
It's intermittent. Most locked sessions finish fine, and I can't trigger it on demand.
Additional context
Every time it got stuck,
process.logshows this right after I hit Escape:My guess from reading
suppression.rs: a key I pressed during the lock never gets its key-up, so it stays inpressed_keys, and a modifier-only shortcut only counts as pressed when that set is empty. Stale key recovery would clear it, but it only runs inIdleandDirty, so it never runs during a lock. Escape switches toDirty, recovery kicks in, and the shortcut works again, but by then the recording is gone.This PR is my attempt at a fix: stale key recovery now also runs for a lock that tracks a held key. It clears the key bookkeeping and keeps the lock, so the next shortcut press finishes normally. The regression test
locked_dictation_finishes_after_a_missing_key_releasefails onmainand passes here.cargo fmt --check,cargo test,cargo clippy --all-targets --all-features -- -D warningsandgit diff --checkall pass locally (Xcode 26.3, macOS 15.8). I haven't tried it in a signed build yet.Currently I am running local build with this fix, will report back maybe in a day if it truly fixed my issues.
Update on Oct 1st: Yep, it was a smooth experience for me after I added this fix in. I would greatly appreciate if this is added so I don't have to rebuild all future versions on my own.
Heads-up: I don't have real Rust knowledge, this fix was drafted by AI agent, so please take the diagnosis and the fix with a grain of salt. It was just frustrating enough that I had a go at it.