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 expand message editor button not always working (#41845)
Finn Everscb5055aaec6a
diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rsindex 5c575de401d..ed354aa930e 100644--- a/crates/agent_ui/src/acp/thread_view.rs+++ b/crates/agent_ui/src/acp/thread_view.rs@@ -881,6 +881,7 @@ impl AcpThreadView {cx: &mut Context<Self>,) {self.set_editor_is_expanded(!self.editor_expanded, cx);+ cx.stop_propagation();cx.notify();}@@ -3978,8 +3979,12 @@ impl AcpThreadView {)}})- .on_click(cx.listener(|_, _, window, cx| {- window.dispatch_action(Box::new(ExpandMessageEditor), cx);+ .on_click(cx.listener(|this, _, window, cx| {+ this.expand_message_editor(+ &ExpandMessageEditor,+ window,+ cx,+ );})),),),diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rsindex 173059ee535..b9aff018dbb 100644--- a/crates/agent_ui/src/agent_panel.rs+++ b/crates/agent_ui/src/agent_panel.rs@@ -19,7 +19,6 @@ use settings::{use zed_actions::OpenBrowser;use zed_actions::agent::{OpenClaudeCodeOnboardingModal, ReauthenticateAgent};-use crate::acp::{AcpThreadHistory, ThreadHistoryEvent};use crate::context_store::ContextStore;use crate::ui::{AcpOnboardingModal, ClaudeCodeOnboardingModal};use crate::{@@ -33,6 +32,10 @@ use crate::{text_thread_editor::{AgentPanelDelegate, TextThreadEditor, make_lsp_adapter_delegate},ui::{AgentOnboardingModal, EndTrialUpsell},};+use crate::{+ ExpandMessageEditor,+ acp::{AcpThreadHistory, ThreadHistoryEvent},+};use crate::{ExternalAgent, NewExternalAgentThread, NewNativeAgentThreadFromSummary, placeholder_command,};@@ -106,6 +109,12 @@ pub fn init(cx: &mut App) {}},)+ .register_action(|workspace, _: &ExpandMessageEditor, window, cx| {+ if let Some(panel) = workspace.panel::<AgentPanel>(cx) {+ workspace.focus_panel::<AgentPanel>(window, cx);+ panel.update(cx, |panel, cx| panel.expand_message_editor(window, cx));+ }+ }).register_action(|workspace, _: &OpenHistory, window, cx| {if let Some(panel) = workspace.panel::<AgentPanel>(cx) {workspace.focus_panel::<AgentPanel>(window, cx);@@ -944,6 +953,15 @@ impl AgentPanel {.detach_and_log_err(cx);}+ fn expand_message_editor(&mut self, window: &mut Window, cx: &mut Context<Self>) {+ if let Some(thread_view) = self.active_thread_view() {+ thread_view.update(cx, |view, cx| {+ view.expand_message_editor(&ExpandMessageEditor, window, cx);+ view.focus_handle(cx).focus(window);+ });+ }+ }+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() {