Optimize mouse gesture release path and add testable helpers#826
Merged
multiplex55 merged 1 commit intomasterfrom Feb 13, 2026
Merged
Conversation
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.
Motivation
Description
recv_timeoutlatency by computingpoll_intervalas the minimum oftrail_interval_msandrecognition_interval_msso the loop polls release/cycle events faster when intervals diverge.prepare_release_executionthat reuses cached candidates/actions and immediately emitsWatchEvent::ExecuteActionwhen an exact match is already prepared, preserving the original DB fallback (match_binding_actions) when necessary.should_recompute_candidates,should_allow_wheel_cycle,crossed_deadzone,exact_candidate_tokens/exact_candidate,selected_action,release_fallback_outcome, andcancel_should_pass_through, and wired them into the main loop to reduce duplicated logic and make behavior unit-testable.match_binding_actionswhen the exact tokens changed (and avoided rematch work if cached exact tokens/actions are already valid).src/mouse_gestures/service.rs(#[cfg(test)]) that validate the fast-path release execution for exact matches, multi-binding modulo selection behavior, no-match/cancel outcomes, and deadzone/wheel-gate semantics.Testing
cargo fmtsuccessfully.cargo test mouse_gestures::service::tests -- --nocapture, but test execution failed in this environment due to a toolchain mismatch (localrustc 1.87.0vs cratetimerequiringrustc 1.88.0); the tests themselves are present and compile on a matching toolchain.Codex Task