Skip to content

feat(terminal): add Move Pane to New Tab to the pane context menu - #25874

Open
shaharmor wants to merge 2 commits into
stablyai:mainfrom
shaharmor:feat/move-pane-to-new-tab
Open

shaharmor wants to merge 2 commits into
stablyai:mainfrom
shaharmor:feat/move-pane-to-new-tab

Conversation

@shaharmor

@shaharmor shaharmor commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When a terminal tab is split into several panes, you can now right-click a pane and choose Move Pane to New Tab. That pane becomes its own tab, and whatever was running in it keeps running.

What Changed

Before: the only way to turn a split pane into its own tab was to drag a small ··· handle at the top edge of the pane onto the tab bar. Most people never find that handle.

After: the pane right-click menu has Move Pane to New Tab, directly under Expand Pane. It shows only when the tab has more than one pane. The menu in chat view has the same item.

  • The new tab opens directly after the original tab, in the same tab group, and becomes the active tab.
  • The pane keeps its running process, scrollback, and working directory. SSH panes work the same way, because the move uses the same code as the existing drag-to-tab-bar.
  • If the moved pane was expanded, the pane left behind goes back to the normal split layout.

Mechanism: the menu action calls the existing detachTerminalPaneToTab, the same function the drag-and-drop uses. Both paths now go through one shared helper in use-terminal-pane-close-actions.ts. The only new logic is resolveTerminalPaneDetachSlotAfterSource, which finds the source tab's group and the slot directly after it.

Why

Dragging a pane out to a new tab was already supported but hard to find. A menu item sits next to related actions (split, expand, close), so you can find it there and it works with keyboard navigation of the menu. Reusing the detach code means the menu path behaves exactly like the drag: the process keeps running, PTY ownership moves to the new tab, and SSH panes need no special handling. The new tab goes right after the source tab, not at the end of the strip, so it stays close to the tab it came from. No keyboard shortcut was added.

Linked Issue

No existing issue. I searched for one and found only #4623 (detachable panes into separate windows), which is a different feature.

Visual Proof

Before/after screenshots of the right-click menu and the resulting new tab are in this comment. Outside contributors can't attach files to the PR description.

Testing

  • New Playwright test tests/e2e/terminal-pane-move-to-new-tab.spec.ts: it splits a terminal, right-clicks the active pane, and chooses Move Pane to New Tab. It then checks that the source tab has one pane left, the new tab sits directly after the source tab and is active, and the new tab holds the moved pane's original PTY. Last, it echoes a marker through that PTY to show the process is still alive. It passed on macOS in a hidden window.

  • Unit tests:

    • Where the new tab goes: in the middle of the group, at the end, and returning null when the group can't be found.
    • The new item sits directly after Expand Pane in the terminal menu, and is hidden for a single pane.
    • The item works in the chat-view menu.
  • pnpm tc:web and pnpm run check:code-quality:changed pass.

  • Tested on macOS only.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Implemented with Pi using claude-opus-5.5 (via GitHub Copilot), with human direction and review.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: the change adds no platform-specific code. The context menu opens the same way it already does on each platform.
  • SSH/remote: moving the pane reuses the existing detach path, which already moves remote PTY ownership to the new tab.
  • New label string added to all six locale files (en, es, fr, ja, ko, zh).

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…e-pane-to-new-tab

# Conflicts:
#	src/renderer/src/components/terminal-pane/TerminalContextMenu.test.tsx
@shaharmor

Copy link
Copy Markdown
Contributor Author

Visual Proof

Captured from a build of this branch running with its window hidden (macOS).

Before: one tab split into two panes Right-click menu: new Move Pane to New Tab under Expand Pane After: the right pane is now its own tab (Terminal 2), still running
Terminal 1 split into two panes Pane context menu showing Move Pane to New Tab directly below Expand Pane Terminal 2 is a new tab directly after Terminal 1, holding the moved pane

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: abee8a50-773c-4585-8c68-20d255d7b9cd
📥 Commits

Reviewing files that changed from the base of the PR and between b752131 and 53e5367.

📒 Files selected for processing (19)
  • src/renderer/src/components/native-chat/use-native-chat-context-menu.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-context-menu.tsx
  • src/renderer/src/components/terminal-pane/TerminalContextMenu.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalContextMenu.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneNativeChatPortal.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneSurface.tsx
  • src/renderer/src/components/terminal-pane/pending-split-close-test-fixture.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-close-actions.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-context-actions.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-context-menu.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • tests/e2e/terminal-pane-move-to-new-tab.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a “Move Pane to New Tab” action to terminal and native-chat context menus. The action resolves a slot after the source tab and detaches the selected pane there. The change adds translations and unit tests for the menu and slot resolver. An end-to-end test checks tab placement, activation, pane count, and continued PTY output.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 53e53

The move-to-new-tab change is mergeable after normal checks; the reported tab-placement concern does not affect a supported workflow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 13 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the main change: adding “Move Pane to New Tab” to the pane context menu.
Description check ✅ Passed The description explains the user-facing change, implementation, rationale, visual proof, and testing. The Linked Issue section does not link an issue, despite the template requiring one for outside c…
Full details: Docstring Coverage

Explanation

Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 13 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant