@@ -1229,6 +1229,9 @@ impl ConversationView {
.and_then(|entry| entry.focus_handle(cx))],
);
});
+ active.update(cx, |active, cx| {
+ active.sync_editor_mode_for_empty_state(cx);
+ });
}
}
AcpThreadEvent::EntryUpdated(index) => {
@@ -1248,6 +1251,9 @@ impl ConversationView {
let list_state = active.read(cx).list_state.clone();
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);
+ });
}
}
AcpThreadEvent::SubagentSpawned(session_id) => self.load_subagent_session(
@@ -533,6 +533,7 @@ impl ThreadView {
};
this.sync_generating_indicator(cx);
+ this.sync_editor_mode_for_empty_state(cx);
let list_state_for_scroll = this.list_state.clone();
let thread_view = cx.entity().downgrade();
@@ -3125,31 +3126,6 @@ impl ThreadView {
(IconName::Maximize, "Expand Message Editor")
};
- if v2_empty_state {
- self.message_editor.update(cx, |editor, cx| {
- editor.set_mode(
- EditorMode::Full {
- scale_ui_elements_with_buffer_font_size: false,
- show_active_line_background: false,
- sizing_behavior: SizingBehavior::Default,
- },
- cx,
- );
- });
- } else {
- self.message_editor.update(cx, |editor, cx| {
- editor.set_mode(
- EditorMode::AutoHeight {
- min_lines: AgentSettings::get_global(cx).message_editor_min_lines,
- max_lines: Some(
- AgentSettings::get_global(cx).set_message_editor_max_lines(),
- ),
- },
- cx,
- );
- });
- }
-
v_flex()
.on_action(cx.listener(Self::expand_message_editor))
.p_2()
@@ -5068,6 +5044,27 @@ impl ThreadView {
})
}
+ pub(crate) fn sync_editor_mode_for_empty_state(&mut self, cx: &mut Context<Self>) {
+ let has_messages = self.list_state.item_count() > 0;
+ let v2_empty_state = cx.has_flag::<AgentV2FeatureFlag>() && !has_messages;
+
+ let mode = if v2_empty_state {
+ EditorMode::Full {
+ scale_ui_elements_with_buffer_font_size: false,
+ show_active_line_background: false,
+ sizing_behavior: SizingBehavior::Default,
+ }
+ } else {
+ EditorMode::AutoHeight {
+ min_lines: AgentSettings::get_global(cx).message_editor_min_lines,
+ max_lines: Some(AgentSettings::get_global(cx).set_message_editor_max_lines()),
+ }
+ };
+ self.message_editor.update(cx, |editor, cx| {
+ editor.set_mode(mode, cx);
+ });
+ }
+
/// Ensures the list item count includes (or excludes) an extra item for the generating indicator
pub(crate) fn sync_generating_indicator(&mut self, cx: &App) {
let is_generating = matches!(self.thread.read(cx).status(), ThreadStatus::Generating);