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: Scroll to the bottom after sending a new message (#30878)

Danilo Leal19e89a8b2d97
diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs
index 737822420fb..11d48a2c3f0 100644
--- a/crates/agent/src/active_thread.rs
+++ b/crates/agent/src/active_thread.rs
@@ -1014,6 +1014,7 @@ impl ActiveThread {
self.push_message(message_id, &message_segments, window, cx);
}
+ self.scroll_to_bottom(cx);
self.save_thread(cx);
cx.notify();
}
@@ -1027,6 +1028,7 @@ impl ActiveThread {
self.edited_message(message_id, &message_segments, window, cx);
}
+ self.scroll_to_bottom(cx);
self.save_thread(cx);
cx.notify();
}
@@ -3408,6 +3410,11 @@ impl ActiveThread {
.or_insert(true);
*is_expanded = !*is_expanded;
}
+
+ pub fn scroll_to_bottom(&mut self, cx: &mut Context<Self>) {
+ self.list_state.reset(self.messages.len());
+ cx.notify();
+ }
}
pub enum ActiveThreadEvent {