agent: Scroll to the bottom after sending a new message (#30878)

Closes https://github.com/zed-industries/zed/issues/30572

Release Notes:

- agent: Improved UX by scrolling to the bottom of the thread after
submitting a new message or editing a previous one.
This commit is contained in:
Danilo Leal 2025-05-17 12:57:00 -03:00 committed by GitHub
parent 919ffe7655
commit 19e89a8b2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {