Fix worktree-selection hotkeys for folders and disabled slots#322
Merged
Conversation
Folder repos in the sidebar bypass `SidebarItemGroupView`, so they never received the ⌃N hint when Cmd was held even though the routing already worked for them. Folder rows now compute the hint via the same shared `AppShortcuts.worktreeSelectionShortcutDisplay` helper as git rows. Clearing a worktree-selection binding in Settings used to make the next slot's key fire the previous slot's button. SwiftUI's `.appKeyboardShortcut(nil)` inside a `CommandMenu` leaves a stale `keyEquivalent` on the underlying `NSMenuItem`. The Select Worktree menu now drops cleared and out-of-range slots upstream so the modifier is never emitted with nil; the same filter closes a sibling case where a disabled `NSMenuItem` whose `keyEquivalent` is bound but whose row doesn't exist swallows the keystroke instead of letting it fall through. The new pure helpers live on `AppShortcuts` and are covered by regression tests in `AppShortcutsTests`.
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.
Summary
SidebarItemGroupView, so the hint never rendered even though the routing already worked..appKeyboardShortcut(nil)inside aCommandMenuleaves a stalekeyEquivalenton the underlyingNSMenuItem, which made the next slot's key fire the previous slot's button. Filtering upstream means the modifier is never emitted with nil. The same filter closes a sibling case where a bound but rowless slot rendered as a disabledNSMenuItemthat swallowed the keystroke (system beep) instead of letting it fall through to the terminal.worktreeSelectionShortcutDisplay,activeWorktreeSelectionSlots) live onAppShortcutsso both the menu and both sidebar hint sites share one source of truth.·(user-facing menu title) or periods (doc comments).Test plan
make build-appmake test(7 new regression tests inAppShortcutsTestscover disabled-override, out-of-range, combined, and the display helper invariants)make check(swift-format + swiftlint clean)