Only focus new terminal if the panel contains focus

Antonio Scandurra and Nathan Sobo created

Co-Authored-By: Nathan Sobo <nathan@zed.dev>

Change summary

crates/terminal_view/src/terminal_panel.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Detailed changes

crates/terminal_view/src/terminal_panel.rs 🔗

@@ -236,7 +236,8 @@ impl TerminalPanel {
                         Box::new(cx.add_view(|cx| {
                             TerminalView::new(terminal, workspace.database_id(), cx)
                         }));
-                    Pane::add_item(workspace, &pane, terminal, true, true, None, cx);
+                    let focus = pane.read(cx).has_focus();
+                    Pane::add_item(workspace, &pane, terminal, true, focus, None, cx);
                 }
             })?;
             this.update(&mut cx, |this, cx| this.serialize(cx))?;