Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent_ui: Fix "scroll to" buttons (#53232)

Danilo Leal1823be56781c
diff --git a/crates/gpui/src/elements/list.rs b/crates/gpui/src/elements/list.rs
index 5525f5c17d2..5a88d81c18d 100644
--- a/crates/gpui/src/elements/list.rs
+++ b/crates/gpui/src/elements/list.rs
@@ -462,6 +462,13 @@ impl ListState {
let current_offset = self.logical_scroll_top();
let state = &mut *self.0.borrow_mut();
+
+ if distance < px(0.) {
+ if let FollowState::Tail { is_following } = &mut state.follow_state {
+ *is_following = false;
+ }
+ }
+
let mut cursor = state.items.cursor::<ListItemSummary>(());
cursor.seek(&Count(current_offset.item_ix), Bias::Right);
@@ -536,6 +543,12 @@ impl ListState {
scroll_top.offset_in_item = px(0.);
}
+ if scroll_top.item_ix < item_count {
+ if let FollowState::Tail { is_following } = &mut state.follow_state {
+ *is_following = false;
+ }
+ }
+
state.logical_scroll_top = Some(scroll_top);
}