From 1f4e9c5aee9f6d892202af90bb0e9c2a2b54ecd6 Mon Sep 17 00:00:00 2001 From: KlausUllrich <33103541+KlausUllrich@users.noreply.github.com> Date: Tue, 12 May 2026 08:24:53 +0200 Subject: [PATCH] gpui: Add is_scrollbar_dragging() accessor to ListState (#53380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Expose whether the scrollbar is currently being dragged via a new `is_scrollbar_dragging()` method on `ListState`. This returns `true` between `scrollbar_drag_started()` and `scrollbar_drag_ended()` calls. It lets consumers distinguish scrollbar drags from wheel/trackpad scrolls, which is useful for suppressing auto-scroll or follow-tail behavior during manual scrollbar positioning. ## Test plan - [x] Code review — one-liner accessor, delegates to existing `scrollbar_drag_start_height` field - [ ] Verify compilation with `cargo check -p gpui` Release Notes: - N/A 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- crates/gpui/src/elements/list.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rs index d417c14e49..54404fa7b2 100644 --- a/crates/gpui/src/elements/list.rs +++ b/crates/gpui/src/elements/list.rs @@ -694,6 +694,16 @@ impl ListState { self.0.borrow_mut().scrollbar_drag_start_height.take(); } + /// Returns `true` if the scrollbar is currently being dragged. + /// + /// This is set between [`scrollbar_drag_started`](Self::scrollbar_drag_started) + /// and [`scrollbar_drag_ended`](Self::scrollbar_drag_ended) calls. Useful for + /// consumers that need to distinguish scrollbar drags from wheel/trackpad scrolls, + /// e.g. to suppress auto-scroll behavior during manual positioning. + pub fn is_scrollbar_dragging(&self) -> bool { + self.0.borrow().scrollbar_drag_start_height.is_some() + } + /// Set the offset from the scrollbar pub fn set_offset_from_scrollbar(&self, point: Point) { self.0.borrow_mut().set_offset_from_scrollbar(point);