From ae44c3c8811472dfb105932eaf4e24a2f2853a4e Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Fri, 19 Dec 2025 09:39:58 -0500 Subject: [PATCH] Fix extra terminal being created when a task replaces a terminal in the center pane (#45317) Closes https://github.com/zed-industries/zed/issues/21144 Release Notes: - Fixed spawned tasks creating an extra terminal in the dock in some cases. --- crates/terminal_view/src/terminal_panel.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index ed43d94e9d3d7c08c1ff4570e08726310360cd93..738a0b4502642423377bdf69b49d26250536761f 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -939,7 +939,6 @@ impl TerminalPanel { cx: &mut Context, ) -> Task>> { let reveal = spawn_task.reveal; - let reveal_target = spawn_task.reveal_target; let task_workspace = self.workspace.clone(); cx.spawn_in(window, async move |terminal_panel, cx| { let project = terminal_panel.update(cx, |this, cx| { @@ -955,6 +954,14 @@ impl TerminalPanel { terminal_to_replace.set_terminal(new_terminal.clone(), window, cx); })?; + let reveal_target = terminal_panel.update(cx, |panel, _| { + if panel.center.panes().iter().any(|p| **p == task_pane) { + RevealTarget::Dock + } else { + RevealTarget::Center + } + })?; + match reveal { RevealStrategy::Always => match reveal_target { RevealTarget::Center => {