Skip unregistered commands in FindCommandByChord, matching ExecuteChord [patch] - #159
Merged
Merged
Conversation
…rd [patch] The #116 fix taught ExecuteChord to skip bindings whose command is no longer registered, but FindCommandByChord still returned the first binding. Once a command was unregistered, "what does this chord do?" named a command that no longer existed while ExecuteChord ran a different one. Both methods now share one helper, so they cannot drift apart again. Fixes #136 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019UNSUUrn4o84JfkEVaD3xg
|
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 #136
Problem
The #116 fix made
ExecuteChordskip bindings whose command is no longer registered.FindCommandByChord(both overloads) still returned the first binding. So after a command was unregistered, the lookup that UIs, the README and the demo use to label a key named a command that no longer exists, while pressing the key ran a different one.Change
ExecuteChordandFindCommandByChordnow share one private helper,FindRegisteredCommand. It returns the first binding whose command is still registered, so the two methods cannot drift apart again.IKeybindingServicedoc comments now say thatFindCommandByChordskips unregistered commands.Behaviour change to note
ProfileChordAccessTests.FindAndExecuteChord_UseTheLockedSnapshotasserted the old behaviour ("FindCommandByChord does not filter by registration"), which is exactly what the issue asks to change. I updated that assertion to expectnull, the same resultExecuteChordgives.Tests
Two new tests in
ExecuteChordTests, each covering both the active-profile and explicit-profile overloads:FindCommandByChord_FirstBindingUnregistered_AgreesWithExecuteChord:athenbare bound,ais unregistered, and the result isb.FindCommandByChord_OnlyBindingUnregistered_ReturnsNullBoth fail on
mainand pass with the fix. The full suite passes locally: 136/136.🤖 Generated with Claude Code
https://claude.ai/code/session_019UNSUUrn4o84JfkEVaD3xg
Generated by Claude Code