From 544badfa33dc47d244aec02b514803c0e4fccd5a Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 21:54:01 +0700 Subject: [PATCH] fix(diff): give the diff overlay the scrollbar every other scroll area has A working tree can run to thousands of lines here, and the overlay was the one long document in the app with nothing to say how far it went or where in it you were. Nine scroll areas already wrap in the shared helper; this one had not even been given a ScrollHandle. --- src/ui/diff_overlay.rs | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/ui/diff_overlay.rs b/src/ui/diff_overlay.rs index 95259152..82159116 100644 --- a/src/ui/diff_overlay.rs +++ b/src/ui/diff_overlay.rs @@ -31,6 +31,7 @@ pub(crate) struct DiffOverlayState { pub(crate) loading: bool, pub(crate) expanded: HashMap, pub(crate) focus: Option, + pub(crate) scroll: gpui::ScrollHandle, } impl Tty7App { @@ -97,6 +98,7 @@ impl Tty7App { loading: false, expanded: HashMap::new(), focus, + scroll: gpui::ScrollHandle::new(), }); window.focus(&focus_handle, cx); self.spawn_diff_probe(cx); @@ -263,9 +265,13 @@ impl Tty7App { DiffLoad::Ready(snap) if empty_snapshot(snap) => { self.diff_message(t(L10nKey::DiffWorkingTreeClean), cx) } - DiffLoad::Ready(snap) => { - self.diff_file_list(snap, &overlay.expanded, focused_file(snap, overlay), cx) - } + DiffLoad::Ready(snap) => self.diff_file_list( + snap, + &overlay.expanded, + focused_file(snap, overlay), + &overlay.scroll, + cx, + ), }; let header = self.diff_header(overlay, window, cx); @@ -455,6 +461,7 @@ impl Tty7App { snap: &DiffSnapshot, expanded: &HashMap, focused: Option, + scroll: &gpui::ScrollHandle, cx: &mut Context, ) -> AnyElement { let stats = snap.stats(); @@ -493,13 +500,19 @@ impl Tty7App { if focused.is_none() && !snap.untracked.is_empty() { list = list.child(self.diff_untracked_section(snap, cx)); } - div() - .id("diff-overlay-scroll") - .flex_1() - .min_h_0() - .overflow_y_scroll() - .child(list) - .into_any_element() + // A whole working tree can scroll past here with nothing to say how + // far it runs or where in it you are — the one long document in the + // app without the bar every other scroll area has. + crate::ui::scrollbar::with_vertical_scrollbar( + "diff-overlay-scrollbar", + div() + .id("diff-overlay-scroll") + .size_full() + .overflow_y_scroll() + .track_scroll(scroll) + .child(list), + scroll, + ) } fn diff_oversized_notice(