# terminal_panel: Cmd\+N opens new terminal where you are already working \(\#48609\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5d8c09e62635e0348a4ab560b85ae7e9514fb9d1)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5d8c09e62635e0348a4ab560b85ae7e9514fb9d1

Requested commit: 5d8c09e62635e0348a4ab560b85ae7e9514fb9d1

Commit: 5d8c09e62635e0348a4ab560b85ae7e9514fb9d1

Tree: 5f222627a1d42cb89d920783e07d13f325cca549

Author: Saurabh Singh

Committer: GitHub

## Message

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

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.



https://github.com/user-attachments/assets/01036cb4-5f1f-456e-900e-eed2e53d61f5


## 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.
```

## Parents

- [1d5dfe61537e8f64e1ed6af5ef391dc193f50c0e](https://git.cafe/gitcafe/zed/commit/1d5dfe61537e8f64e1ed6af5ef391dc193f50c0e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5d8c09e62635e0348a4ab560b85ae7e9514fb9d1?format=markdown)
