git_panel: Fix space key being swallowed in branch picker#52779
Merged
ChristopherBiscardi merged 1 commit intozed-industries:mainfrom Mar 31, 2026
Merged
Conversation
Contributor
Contributor
|
Thanks again! Validated the change and spaces can once again be typed. Although, spaces are not used to match against existing branch names with |
Contributor
|
@zed-zippy approve |
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.
Context
Fixes a regression where typing a space in the Git Panel's "Switch Branch" picker would make no response at all instead of inserting the character. The same picker in the title-bar Git Switcher was unaffected.
Root cause:
PopoverMenulinks the opened menu's focus handle into the parent element's dispatch tree so thatcontains_focusedreturnstrueon the parent while the popover is open.GitPanel::dispatch_contextusescontains_focusedto decide whether to add theChangesListkey context, so that context is active while the branch picker is open. BecausePickerandEditorhave no binding for a barespace, dispatch fell through tothe
"GitPanel && ChangesList"binding, which mapsspacetogit::ToggleStaged, consuming the keystroke before it could reach the text input.The fix narrows the context guard to
"GitPanel && ChangesList && !GitBranchSelector",so those bindings are skipped whenever the branch picker (or any other
GitBranchSelectorcontext) is focused inside the panel.The same change is applied to the vim keymap, which would have similarly intercepted
k,j,x, and other letter keys typed in the picker, this behavior was observed in #52617 and I made the same fix in #52687Closes #52771 and potentially #52617
Video of the manual test of the fix below :
Screencast.from.2026-03-31.00-01-54.webm
How to Review
assets/keymaps/default-linux.json,default-windows.json,default-macos.json,vim.json: identical one-line change in each: I added&& !GitBranchSelectortothe
"GitPanel && ChangesList". No Rust changes needed.
Self-Review Checklist
Release Notes: