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.
This commit is contained in:
1 parent
158259a829
commit
51fe6ba869
1 file changed
+8
-1
@@ -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 => {
|
||||
|
||||
Reference in new issue
Block a user