Skip to content

terminal_panel: Cmd+N opens new terminal where you are already working#48609

Merged
SomeoneToIgnore merged 1 commit intozed-industries:mainfrom
srbsingh3:new-terminal-follows-focus-context
Mar 24, 2026
Merged

terminal_panel: Cmd+N opens new terminal where you are already working#48609
SomeoneToIgnore merged 1 commit intozed-industries:mainfrom
srbsingh3:new-terminal-follows-focus-context

Conversation

@srbsingh3
Copy link
Copy Markdown
Contributor

@srbsingh3 srbsingh3 commented Feb 6, 2026

Related to #31504

Problem

If you drag a terminal into the center editor area as a tab, pressing Cmd+N still opens the new terminal in the terminal panel instead of next to the tab you're looking at.

Solution

Cmd+N now checks whether the center pane is focused and its active tab is a terminal. If both are true, the new terminal opens there. All other behavior is unchanged.

demo-new-terminal-command.mp4

Test plan

  • Drag a terminal into the center editor area. Focus it. Press Cmd+N. New terminal opens as a center tab.
  • Toggle terminal panel with Ctrl+`. Press Cmd+N. Opens in panel as before.
  • Focus a regular code file. Press Cmd+N. Opens in panel as before.
  • Have a terminal in the center, but focus the terminal panel. Press Cmd+N. Opens in panel as before.

Release Notes:

  • Improved terminal: New Terminal (Cmd+N) to open in the center pane when a terminal tab there is focused, instead of always opening in the terminal panel.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 6, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 6, 2026
@maxdeviant maxdeviant changed the title terminal_panel: Cmd+N opens new terminal where you're already working terminal_panel: Make Cmd0-N open new terminal where you're already working Feb 6, 2026
@srbsingh3 srbsingh3 changed the title terminal_panel: Make Cmd0-N open new terminal where you're already working terminal_panel: Cmd+N opens new terminal where you are already working Feb 6, 2026
@SomeoneToIgnore SomeoneToIgnore self-assigned this Mar 24, 2026
Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change, thank you.

Let's do another small update of the logic while we're here and merge this.

@@ -659,6 +659,29 @@ impl TerminalPanel {
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the new approach also open the center terminal in this case?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it above the guard, thanks for catching this.

@srbsingh3 srbsingh3 force-pushed the new-terminal-follows-focus-context branch from 831b736 to b32a7f1 Compare March 24, 2026 16:47
Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

Looks like the formatting CI check is failing.

@srbsingh3
Copy link
Copy Markdown
Contributor Author

Oops. Let me take a look.

@srbsingh3 srbsingh3 force-pushed the new-terminal-follows-focus-context branch from b32a7f1 to defe9c8 Compare March 24, 2026 20:49
@srbsingh3
Copy link
Copy Markdown
Contributor Author

Rebased on main — adapted tests to the MultiWorkspace refactor, no logic changes.

@SomeoneToIgnore SomeoneToIgnore enabled auto-merge (squash) March 24, 2026 21:04
@github-actions
Copy link
Copy Markdown

📏 PR Size: 451 lines changed (Size L)

Please note: this PR exceeds the 400 LOC soft limit.

  • Consider splitting into separate PRs if the changes are separable
  • Ensure the PR description includes a guided tour in the "How to Review" section so reviewers know where to start

@SomeoneToIgnore SomeoneToIgnore merged commit 5d8c09e into zed-industries:main Mar 24, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions large-pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants