From 60a7455f12cabbcb357a9ebc9c98273237c762fb Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 28 Mar 2025 10:32:31 -0400 Subject: [PATCH] assistant2: Don't scroll down if user has scrolled up (#27614) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This caused undesirable and unnecessary scrolling, in that if you scroll up, then as new messages stream into the panel, they jump the scroll bar back down. @agu-z and I paired on this and we think this is unnecessary now that we don't see the Edit button in the UI, but @bennetbo we still see code for the button in there, so...maybe we do still want this? (If so, we can revert the second commit and go back to a more conditional way of scrolling. 😄) Release Notes: - N/A --------- Co-authored-by: Agus --- crates/assistant2/src/active_thread.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index 9d71a1f8f95d2a4c74305ce2ee5401c5471f7178..46d037c296d226808f43047240a734c02e808cc1 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -12,9 +12,9 @@ use editor::{Editor, MultiBuffer}; use gpui::{ linear_color_stop, linear_gradient, list, percentage, pulsating_between, AbsoluteLength, Animation, AnimationExt, AnyElement, App, ClickEvent, DefiniteLength, EdgesRefinement, Empty, - Entity, Focusable, Hsla, Length, ListAlignment, ListOffset, ListState, MouseButton, - ScrollHandle, Stateful, StyleRefinement, Subscription, Task, TextStyleRefinement, - Transformation, UnderlineStyle, WeakEntity, WindowHandle, + Entity, Focusable, Hsla, Length, ListAlignment, ListState, MouseButton, ScrollHandle, Stateful, + StyleRefinement, Subscription, Task, TextStyleRefinement, Transformation, UnderlineStyle, + WeakEntity, WindowHandle, }; use language::{Buffer, LanguageRegistry}; use language_model::{LanguageModelRegistry, LanguageModelToolUseId, Role}; @@ -317,10 +317,6 @@ impl ActiveThread { let rendered_message = RenderedMessage::from_segments(segments, self.language_registry.clone(), window, cx); self.rendered_messages_by_id.insert(*id, rendered_message); - self.list_state.scroll_to(ListOffset { - item_ix: old_len, - offset_in_item: Pixels(0.0), - }); } fn edited_message(