Skip to content

Skip unregistered commands when executing a shared chord - #118

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/execute-chord-skips-unregistered-116
Sep 26, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/execute-chord-skips-unregistered-116

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #116

Problem

ExecuteChord resolved the chord with FindCommandByChord, 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, ExecuteChord returned null even 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. FindCommandByChord is 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

ExecuteChordTests is new:

  • The issue's repro (a and b both bound to Ctrl+S, a unregistered) now runs b, for both the active-profile and the explicit-profile overloads.
  • When both commands are registered, the first binding still wins, so ExecuteChord agrees with FindCommandByChord.
  • When the only binding is unregistered, the result is null.
  • An unknown or blank profile ID returns 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

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
@sonarqubecloud

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 1f60476 into main Sep 26, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the fix/execute-chord-skips-unregistered-116 branch September 26, 2026 11:33
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.

ExecuteChord returns null when the first binding for a chord belongs to an unregistered command, even if a registered command shares the chord

1 participant