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 history view losing focus when empty (#42374)
Danilo Lealed61a79cc5a2
diff --git a/crates/agent_ui/src/acp/thread_history.rs b/crates/agent_ui/src/acp/thread_history.rsindex f8a2006f8fc..11718c63475 100644--- a/crates/agent_ui/src/acp/thread_history.rs+++ b/crates/agent_ui/src/acp/thread_history.rs@@ -457,25 +457,23 @@ impl Render for AcpThreadHistory {.on_action(cx.listener(Self::select_last)).on_action(cx.listener(Self::confirm)).on_action(cx.listener(Self::remove_selected_thread))- .when(!self.history_store.read(cx).is_empty(cx), |parent| {- parent.child(- h_flex()- .h(px(41.)) // Match the toolbar perfectly- .w_full()- .py_1()- .px_2()- .gap_2()- .justify_between()- .border_b_1()- .border_color(cx.theme().colors().border)- .child(- Icon::new(IconName::MagnifyingGlass)- .color(Color::Muted)- .size(IconSize::Small),- )- .child(self.search_editor.clone()),- )- })+ .child(+ h_flex()+ .h(px(41.)) // Match the toolbar perfectly+ .w_full()+ .py_1()+ .px_2()+ .gap_2()+ .justify_between()+ .border_b_1()+ .border_color(cx.theme().colors().border)+ .child(+ Icon::new(IconName::MagnifyingGlass)+ .color(Color::Muted)+ .size(IconSize::Small),+ )+ .child(self.search_editor.clone()),+ ).child({let view = v_flex().id("list-container")@@ -484,19 +482,15 @@ impl Render for AcpThreadHistory {.flex_grow();if self.history_store.read(cx).is_empty(cx) {- view.justify_center()- .child(- h_flex().w_full().justify_center().child(- Label::new("You don't have any past threads yet.")- .size(LabelSize::Small),- ),- )- } else if self.search_produced_no_matches() {- view.justify_center().child(- h_flex().w_full().justify_center().child(- Label::new("No threads match your search.").size(LabelSize::Small),- ),+ view.justify_center().items_center().child(+ Label::new("You don't have any past threads yet.")+ .size(LabelSize::Small)+ .color(Color::Muted),)+ } else if self.search_produced_no_matches() {+ view.justify_center()+ .items_center()+ .child(Label::new("No threads match your search.").size(LabelSize::Small))} else {view.child(uniform_list(