git_ui: Enable navigation for single-hunk diffs - #62615
Conversation
dinocosta
left a comment
There was a problem hiding this comment.
Hey @macayu17 ! Thank you for taking a stab at this 🙂
Sorry to ask but I'm wondering if you did manage to test these changes yourself, given the following in the Pull Request description, which makes it seem like you were unable to compile the code on your end.
Attempted cargo test -p git_ui solo_diff_view::tests::test_changes_only_multibuffer_has_one_buffer_and_expand_controls; compilation could not complete because MSVC link.exe is unavailable in the local environment.
If possible, can you attach a screen recording showing the updated UI? Thanks!
|
Thanks for checking. I rebuilt the branch using the Windows GNU toolchain and ran the full git_ui library suite. All 130 tests passed. I also verified the single-hunk navigation in the branch-built app and attached a screen recording above. |
What
Keep the hunk navigation controls available when a diff contains one hunk, so users can return to it after scrolling away. This applies to solo, staged, unstaged, and project diff views.
Why
The controls were only rendered when
hunk_count > 1, even though the existing navigation actions already wrap and recenter a single hunk.How
Render the previous and next hunk controls whenever
hunk_count > 0, reusing the existing navigation actions.Closes #62469
Testing
cargo +stable-x86_64-pc-windows-gnu test -p git_ui --lib— 130 passed.cargo +stable-x86_64-pc-windows-gnu build -p zed -j 1— passed.rustfmt --edition 2024 --checkon the four changed files — passed.git diff --check— passed.Showcase
single-hunk-navigation-clean.mp4
Self-Review Checklist
Release Notes: