From 62787614601e71c4817ca1fe5bb52ac1140a1f33 Mon Sep 17 00:00:00 2001 From: 5brian Date: Mon, 14 Apr 2025 09:56:24 -0400 Subject: [PATCH] agent: Fix expand message editor while not focused (#28650) Allow expanding the message editor while the agent panel is not focused, right now there is no effect when you use the button from another focus Release Notes: - N/A --- crates/agent/src/assistant_panel.rs | 14 ++++++++++++-- crates/agent/src/message_editor.rs | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/crates/agent/src/assistant_panel.rs b/crates/agent/src/assistant_panel.rs index 0d8682abf5..3e53ece36c 100644 --- a/crates/agent/src/assistant_panel.rs +++ b/crates/agent/src/assistant_panel.rs @@ -44,8 +44,8 @@ use crate::thread::{Thread, ThreadError, ThreadId, TokenUsageRatio}; use crate::thread_history::{PastContext, PastThread, ThreadHistory}; use crate::thread_store::ThreadStore; use crate::{ - AgentDiff, InlineAssistant, NewTextThread, NewThread, OpenActiveThreadAsMarkdown, - OpenAgentDiff, OpenHistory, ThreadEvent, ToggleContextPicker, + AgentDiff, ExpandMessageEditor, InlineAssistant, NewTextThread, NewThread, + OpenActiveThreadAsMarkdown, OpenAgentDiff, OpenHistory, ThreadEvent, ToggleContextPicker, }; pub fn init(cx: &mut App) { @@ -90,6 +90,16 @@ pub fn init(cx: &mut App) { let thread = panel.read(cx).thread.read(cx).thread().clone(); AgentDiff::deploy_in_workspace(thread, workspace, window, cx); } + }) + .register_action(|workspace, _: &ExpandMessageEditor, window, cx| { + if let Some(panel) = workspace.panel::(cx) { + workspace.focus_panel::(window, cx); + panel.update(cx, |panel, cx| { + panel.message_editor.update(cx, |editor, cx| { + editor.expand_message_editor(&ExpandMessageEditor, window, cx); + }); + }); + } }); }, ) diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rs index bdc7c67cff..3b8881f2d8 100644 --- a/crates/agent/src/message_editor.rs +++ b/crates/agent/src/message_editor.rs @@ -157,7 +157,7 @@ impl MessageEditor { cx.notify(); } - fn expand_message_editor( + pub fn expand_message_editor( &mut self, _: &ExpandMessageEditor, _window: &mut Window,