Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent_ui: Don't create a new terminal when hitting the new thread binding from the terminal (#42898)
Danilo Lealfaa1136651c1
diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rsindex f4c76b10573..82237d86ba9 100644--- a/crates/agent_ui/src/acp/thread_view.rs+++ b/crates/agent_ui/src/acp/thread_view.rs@@ -51,7 +51,7 @@ use ui::{PopoverMenuHandle, SpinnerLabel, TintColor, Tooltip, WithScrollbar, prelude::*,};use util::{ResultExt, size::format_file_size, time::duration_alt_display};-use workspace::{CollaboratorId, Workspace};+use workspace::{CollaboratorId, NewTerminal, Workspace};use zed_actions::agent::{Chat, ToggleModelSelector};use zed_actions::assistant::OpenRulesLibrary;@@ -69,8 +69,8 @@ use crate::ui::{};use crate::{AgentDiffPane, AgentPanel, AllowAlways, AllowOnce, ContinueThread, ContinueWithBurnMode,- CycleModeSelector, ExpandMessageEditor, Follow, KeepAll, OpenAgentDiff, OpenHistory, RejectAll,- RejectOnce, ToggleBurnMode, ToggleProfileSelector,+ CycleModeSelector, ExpandMessageEditor, Follow, KeepAll, NewThread, OpenAgentDiff, OpenHistory,+ RejectAll, RejectOnce, ToggleBurnMode, ToggleProfileSelector,};#[derive(Copy, Clone, Debug, PartialEq, Eq)]@@ -3144,7 +3144,7 @@ impl AcpThreadView {.text_ui_sm(cx).h_full().children(terminal_view.map(|terminal_view| {- if terminal_view+ let element = if terminal_view.read(cx).content_mode(window, cx).is_scrollable()@@ -3152,7 +3152,15 @@ impl AcpThreadView {div().h_72().child(terminal_view).into_any_element()} else {terminal_view.into_any_element()- }+ };++ div()+ .on_action(cx.listener(|_this, _: &NewTerminal, window, cx| {+ window.dispatch_action(NewThread.boxed_clone(), cx);+ cx.stop_propagation();+ }))+ .child(element)+ .into_any_element()})),)})