Skip to content

Commit

Permalink
Focus terminal when creating one after activating the terminal panel (#…
Browse files Browse the repository at this point in the history
…22133)

Follow-up of #22082

Release Notes:

- N/A
  • Loading branch information
SomeoneToIgnore authored Dec 17, 2024
1 parent 4878b9b commit cc56ed7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/terminal_view/src/terminal_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,6 @@ impl TerminalPanel {
cx: &mut ViewContext<Self>,
) -> Task<Result<Model<Terminal>>> {
let workspace = self.workspace.clone();
self.pending_terminals_to_add += 1;

cx.spawn(|terminal_panel, mut cx| async move {
if workspace.update(&mut cx, |workspace, cx| {
!is_enabled_in_workspace(workspace, cx)
Expand Down Expand Up @@ -753,10 +751,6 @@ impl TerminalPanel {
cx,
)
}));
pane.update(cx, |pane, cx| {
let focus = pane.has_focus(cx);
pane.add_item(terminal_view, true, focus, None, cx);
});

match reveal_strategy {
RevealStrategy::Always => {
Expand All @@ -767,6 +761,13 @@ impl TerminalPanel {
}
RevealStrategy::Never => {}
}

pane.update(cx, |pane, cx| {
let focus =
pane.has_focus(cx) || matches!(reveal_strategy, RevealStrategy::Always);
pane.add_item(terminal_view, true, focus, None, cx);
});

Ok(terminal)
})?;
terminal_panel.update(&mut cx, |this, cx| {
Expand Down

0 comments on commit cc56ed7

Please sign in to comment.