fix(blame): correct scrollbar max so thumb reaches bottom at last line#2975
Open
Noethix55555 wants to merge 1 commit into
Open
fix(blame): correct scrollbar max so thumb reaches bottom at last line#2975Noethix55555 wants to merge 1 commit into
Noethix55555 wants to merge 1 commit into
Conversation
The draw_scrollbar call used a stale workaround from April 2021 when tui-rs subtracted area.height internally; that subtraction no longer exists in draw_scrollbar, so passing number_of_rows + area.height as the max inflated it artificially. At the last row the thumb reached at most ~76% of the scrollbar height (for a 100-line file in a 30-row terminal). Use number_of_rows.saturating_sub(1) -- the last valid selection index -- matching the pattern used by taglist and fuzzy_find.
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
The
draw_scrollbarcall inBlameFilePopup::drawhas used a stale workaround since April 2021, whentui-rsinternally subtractedarea.heightfrom themaxparameter before computing the thumb position. That subtraction was never part of our owndraw_scrollbar(insrc/ui/scrollbar.rs), so passingnumber_of_rows + area.heightasmaxinflates it artificially.Effect: The scrollbar thumb never reaches the bottom. For a 100-line file displayed in a 30-row terminal, the furthest the thumb travels is
99 / 130 ≈ 76%— even when the cursor is on the last line.Fix: Pass
number_of_rows.saturating_sub(1)asmax, matching the pattern used bytaglistandfuzzy_find(which passlen.saturating_sub(1)and work correctly). Remove the now-obsolete comments.Test plan
End