From 51ffb5df91128d35c172dd76a5e5ecc6cc47fd27 Mon Sep 17 00:00:00 2001 From: Noethix55555 <277300782+Noethix55555@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:16:23 -0400 Subject: [PATCH] fix(blame): correct scrollbar max so thumb reaches bottom at last line 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. --- src/popups/blame_file.rs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/popups/blame_file.rs b/src/popups/blame_file.rs index b7d1304b33..a0d7cd53a4 100644 --- a/src/popups/blame_file.rs +++ b/src/popups/blame_file.rs @@ -158,23 +158,7 @@ impl DrawableComponent for BlameFilePopup { f, area, &self.theme, - // April 2021: `draw_scrollbar` assumes that the last parameter - // is `scroll_top`. Therefore, it subtracts the area’s height - // before calculating the position of the scrollbar. To account - // for that, we add the current height. - number_of_rows + (area.height as usize), - // April 2021: we don’t have access to `table_state.offset` - // (it’s private), so we use `table_state.selected()` as a - // replacement. - // - // Other widgets, for example `BranchListComponent`, manage - // scroll state themselves and use `self.scroll_top` in this - // situation. - // - // There are plans to change `render_stateful_widgets`, so this - // might be acceptable as an interim solution. - // - // https://github.com/fdehau/tui-rs/issues/448 + number_of_rows.saturating_sub(1), table_state.selected().unwrap_or(0), ui::Orientation::Vertical, );