Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix first window open not focusing the modals (#43180)
Kirill Bulatov303c23cf1e7c
diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rsindex 92765140f51..fd0b1eedbdf 100644--- a/crates/agent_ui/src/acp/thread_view.rs+++ b/crates/agent_ui/src/acp/thread_view.rs@@ -653,7 +653,6 @@ impl AcpThreadView {mode_selector,_subscriptions: subscriptions,};- this.message_editor.focus_handle(cx).focus(window);this.profile_selector = this.as_native_thread(cx).map(|thread| {cx.new(|cx| {diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 6ff90938998..22eb11e24a8 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -816,6 +816,7 @@ impl AgentPanel {window,cx,),+ true,window,cx,);@@ -911,7 +912,12 @@ impl AgentPanel {)});- this.set_active_view(ActiveView::ExternalAgentThread { thread_view }, window, cx);+ this.set_active_view(+ ActiveView::ExternalAgentThread { thread_view },+ !loading,+ window,+ cx,+ );})}).detach_and_log_err(cx);@@ -953,10 +959,10 @@ impl AgentPanel {fn open_history(&mut self, window: &mut Window, cx: &mut Context<Self>) {if matches!(self.active_view, ActiveView::History) {if let Some(previous_view) = self.previous_view.take() {- self.set_active_view(previous_view, window, cx);+ self.set_active_view(previous_view, true, window, cx);}} else {- self.set_active_view(ActiveView::History, window, cx);+ self.set_active_view(ActiveView::History, true, window, cx);}cx.notify();}@@ -1012,6 +1018,7 @@ impl AgentPanel {window,cx,),+ true,window,cx,);@@ -1157,7 +1164,7 @@ impl AgentPanel {let context_server_store = self.project.read(cx).context_server_store();let fs = self.fs.clone();- self.set_active_view(ActiveView::Configuration, window, cx);+ self.set_active_view(ActiveView::Configuration, true, window, cx);self.configuration = Some(cx.new(|cx| {AgentConfiguration::new(fs,@@ -1274,6 +1281,7 @@ impl AgentPanel {fn set_active_view(&mut self,new_view: ActiveView,+ focus: bool,window: &mut Window,cx: &mut Context<Self>,) {@@ -1312,7 +1320,9 @@ impl AgentPanel {self.active_view = new_view;}- self.focus_handle(cx).focus(window);+ if focus {+ self.focus_handle(cx).focus(window);+ }}fn populate_recently_opened_menu_section(