git_ui: Fix tree view next selection out of bounds#49283
Merged
kubkon merged 2 commits intozed-industries:mainfrom Feb 17, 2026
Merged
git_ui: Fix tree view next selection out of bounds#49283kubkon merged 2 commits intozed-industries:mainfrom
kubkon merged 2 commits intozed-industries:mainfrom
Conversation
This change ensures that when the last visible collapsed directory is selected, the selection remains on that directory.
Contributor
|
Nice, you beat me to it! |
kubkon
requested changes
Feb 17, 2026
Member
kubkon
left a comment
There was a problem hiding this comment.
Looks great! I've got a couple of nits though that hopefully are straightforward to address.
crates/git_ui/src/git_panel.rs
Outdated
| else { | ||
| return; | ||
| }; | ||
| self.selected_entry = Some(new_selected_entry); |
Member
There was a problem hiding this comment.
This check seems redundant:
- in
GitPanelViewMode::Flat, we already check for this - in
GitPanelViewMode::Tree, next entry is bound bylogical_indicesprecludes this case
Lemme know if I missed something though! Also, your test does not account for this which strengthens my belief that this check is redundant.
Contributor
Author
There was a problem hiding this comment.
Right, i've updated it now
Comment on lines
+7238
to
+7247
| ".git": {}, | ||
| "src": { | ||
| "a": { | ||
| "foo.rs": "fn foo() {}", | ||
| }, | ||
| "b": { | ||
| "bar.rs": "fn bar() {}", | ||
| "baz.rs": "fn baz() {}", | ||
| }, | ||
| }, |
Member
There was a problem hiding this comment.
Looks good! I would suggest we strive to replicate @mchisolm0's repro with one twist - let's add a GitHeader entry into the mix, so something like this:
Tracked
bar/
bar1.py
bar2.py
foo/
foo1.py
foo2.py
Untracked
foobar.py
kubkon
approved these changes
Feb 17, 2026
Member
|
/cherry-pick preview |
github-actions bot
pushed a commit
that referenced
this pull request
Feb 17, 2026
Closes #49259 Release Notes: - This change ensures that when the last visible collapsed directory is selected, the selection remains on that directory.
kubkon
added a commit
that referenced
this pull request
Feb 18, 2026
…ick to preview) (#49415) Cherry-pick of #49283 to preview ---- Closes #49259 Release Notes: - This change ensures that when the last visible collapsed directory is selected, the selection remains on that directory. --------- Co-authored-by: Mayank Verma <errmayank@gmail.com> Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
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.
Closes #49259
Before you mark this PR as ready for review, make sure that you have:
Release Notes: