diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index 5c575de401daf26bd7815bc49d923072243ee980..ed354aa930e3ca07c4782bccdf23f54153366aba 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.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.rs index 173059ee535d4417cd0ff493842d889559b85ef4..b9aff018dbb520ad524e182800ffe057cbf9305a 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::(cx) { + workspace.focus_panel::(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::(cx) { workspace.focus_panel::(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) { + 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) { if matches!(self.active_view, ActiveView::History) { if let Some(previous_view) = self.previous_view.take() {