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.
5d8c09e626Saurabh Singh committed on 3/24/2026, 9:10:24 PM· committed by GitHubparent1d5dfe6
1 file changedLine totals unavailable