Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix extra terminal being created when a task replaces a terminal in the center pane (#45317)

Cole Millerae44c3c88114
diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs
index ed43d94e9d3..738a0b45026 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<Self>,
) -> Task<Result<WeakEntity<Terminal>>> {
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 => {