diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-03 02:47:48 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-03 02:47:48 +0300 |
| commit | 94f6d9c0d9bb9cf9ffae99d8bbfb09e9bf2fc9e0 (patch) | |
| tree | e4dfc7ea631cbb872ffc59a7ca0270a8fe000d7d /src/client/shell/scroll.rs | |
| parent | 2ae8b91ca5919c26df7ce779b0e9a5dd98b769ae (diff) | |
fix: reveal newly focused spaces in the sidebar (#3554)
Diffstat (limited to 'src/client/shell/scroll.rs')
| -rw-r--r-- | src/client/shell/scroll.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/client/shell/scroll.rs b/src/client/shell/scroll.rs index a0496cb8..4ff507d9 100644 --- a/src/client/shell/scroll.rs +++ b/src/client/shell/scroll.rs @@ -53,6 +53,29 @@ pub(super) fn list_scroll_metrics( } } +pub(super) fn list_scroll_start_to_reveal( + row_heights: &[u16], + gaps_after: &[u16], + body_height: u16, + requested_start: usize, + target: usize, +) -> usize { + let mut metrics = list_scroll_metrics(row_heights, gaps_after, body_height, requested_start); + let mut start = metrics + .max_offset_from_bottom + .saturating_sub(metrics.offset_from_bottom); + if target < start { + return target; + } + while target >= start.saturating_add(metrics.viewport_rows) + && start < metrics.max_offset_from_bottom + { + start = start.saturating_add(1); + metrics = list_scroll_metrics(row_heights, gaps_after, body_height, start); + } + start +} + pub(super) fn render_list_scrollbar( buffer: &mut Buffer, track: Rect, |
