Skip unregistered commands when executing a shared chord - #118
Merged
Merged
Conversation
ExecuteChord took the first binding for the chord and only then checked whether its command was registered, so an unregistered command bound first hid a registered command sharing the same chord. Filter candidate bindings by IsCommandRegistered before picking one. Fixes #116 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CZB6C9rAp2hA5WQDcw2NDp
|
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.



Fixes #116
Problem
ExecuteChordresolved the chord withFindCommandByChord, which returns the first binding in the profile, and only then checked whether that command was registered. If two commands share a chord and the first one is unregistered,ExecuteChordreturnednulleven though a registered command was bound to the same keys.Fix
ExecuteChord(profileId, chord)now looks for the first binding that matches the chord and whose command is registered.FindCommandByChordis unchanged, so it still reports the raw binding.The optional follow-ups from the issue are deliberately left out, since they are API decisions: dropping bindings when a command is unregistered, and conflict reporting in
BindChord.Tests
ExecuteChordTestsis new:aandbboth bound toCtrl+S,aunregistered) now runsb, for both the active-profile and the explicit-profile overloads.ExecuteChordagrees withFindCommandByChord.null.null.With the fix reverted, the repro test fails. With it, the full suite passes (79/79,
dotnet test -c Release).🤖 Generated with Claude Code
https://claude.ai/code/session_01CZB6C9rAp2hA5WQDcw2NDp
Generated by Claude Code