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 expanded message editor staying auto-height during streaming (#55916)
soddygoc80020231bcc
diff --git a/crates/agent_ui/src/conversation_view.rs b/crates/agent_ui/src/conversation_view.rsindex 65632e9406b..110961b34f1 100644--- a/crates/agent_ui/src/conversation_view.rs+++ b/crates/agent_ui/src/conversation_view.rs@@ -1614,7 +1614,7 @@ impl ConversationView {});active.update(cx, |active, cx| {active.sync_elicitation_state_for_entry(index, window, cx);- active.sync_editor_mode_for_empty_state(cx);+ active.sync_editor_mode(cx);active.sync_generating_indicator(cx);});}@@ -1641,7 +1641,7 @@ impl ConversationView {entry_view_state.update(cx, |view_state, _cx| view_state.remove(range.clone()));list_state.splice(range.clone(), 0);active.update(cx, |active, cx| {- active.sync_editor_mode_for_empty_state(cx);+ active.sync_editor_mode(cx);});}}diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rsindex 90ea600ff5f..fe8b7b29233 100644--- a/crates/agent_ui/src/conversation_view/thread_view.rs+++ b/crates/agent_ui/src/conversation_view/thread_view.rs@@ -1036,7 +1036,7 @@ impl ThreadView {};this.sync_generating_indicator(cx);- this.sync_editor_mode_for_empty_state(cx);+ this.sync_editor_mode(cx);this.sync_existing_elicitation_states(window, cx);let list_state_for_scroll = this.list_state.clone();let thread_view = cx.entity().downgrade();@@ -2373,27 +2373,7 @@ impl ThreadView {pub fn set_editor_is_expanded(&mut self, is_expanded: bool, cx: &mut Context<Self>) {self.editor_expanded = is_expanded;- self.message_editor.update(cx, |editor, cx| {- if is_expanded {- editor.set_mode(- EditorMode::Full {- scale_ui_elements_with_buffer_font_size: false,- show_active_line_background: false,- sizing_behavior: SizingBehavior::ExcludeOverscrollMargin,- },- cx,- )- } else {- let agent_settings = AgentSettings::get_global(cx);- editor.set_mode(- EditorMode::AutoHeight {- min_lines: agent_settings.message_editor_min_lines,- max_lines: Some(agent_settings.set_message_editor_max_lines()),- },- cx,- )- }- });+ self.sync_editor_mode(cx);cx.notify();}@@ -7104,11 +7084,21 @@ impl ThreadView {open_markdown_in_workspace(thread_title, markdown, workspace, window, cx)}- pub(crate) fn sync_editor_mode_for_empty_state(&mut self, cx: &mut Context<Self>) {+ pub(crate) fn sync_editor_mode(&mut self, cx: &mut Context<Self>) {let has_messages = self.list_state.item_count() > 0;let v2_empty_state = !has_messages;- let mode = if v2_empty_state {+ if !has_messages {+ self.editor_expanded = false;+ }++ let mode = if self.editor_expanded {+ EditorMode::Full {+ scale_ui_elements_with_buffer_font_size: false,+ show_active_line_background: false,+ sizing_behavior: SizingBehavior::ExcludeOverscrollMargin,+ }+ } else if v2_empty_state {EditorMode::Full {scale_ui_elements_with_buffer_font_size: false,show_active_line_background: false,