Skip to content

Commit ae44c3c

Browse files
authored
Fix extra terminal being created when a task replaces a terminal in the center pane (#45317)
Closes #21144 Release Notes: - Fixed spawned tasks creating an extra terminal in the dock in some cases.
1 parent 4e0471c commit ae44c3c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎crates/terminal_view/src/terminal_panel.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,6 @@ impl TerminalPanel {
939939
cx: &mut Context<Self>,
940940
) -> Task<Result<WeakEntity<Terminal>>> {
941941
let reveal = spawn_task.reveal;
942-
let reveal_target = spawn_task.reveal_target;
943942
let task_workspace = self.workspace.clone();
944943
cx.spawn_in(window, async move |terminal_panel, cx| {
945944
let project = terminal_panel.update(cx, |this, cx| {
@@ -955,6 +954,14 @@ impl TerminalPanel {
955954
terminal_to_replace.set_terminal(new_terminal.clone(), window, cx);
956955
})?;
957956

957+
let reveal_target = terminal_panel.update(cx, |panel, _| {
958+
if panel.center.panes().iter().any(|p| **p == task_pane) {
959+
RevealTarget::Dock
960+
} else {
961+
RevealTarget::Center
962+
}
963+
})?;
964+
958965
match reveal {
959966
RevealStrategy::Always => match reveal_target {
960967
RevealTarget::Center => {

0 commit comments

Comments
 (0)