Skip to content

Support for simultaneously moving multiple tabs across windows#20006

Open
DevDengChao wants to merge 6 commits intomicrosoft:mainfrom
DevDengChao:codex/multitab-drag-windows
Open

Support for simultaneously moving multiple tabs across windows#20006
DevDengChao wants to merge 6 commits intomicrosoft:mainfrom
DevDengChao:codex/multitab-drag-windows

Conversation

@DevDengChao
Copy link

Summary of the Pull Request

  • support dragging one or more selected tabs out of a window to create a new top-level window
  • support dropping one or more selected tabs onto an existing window, preserving source order and inserting after the drop target
  • add unit, LocalTests, and UIA coverage so the cross-window drag path is validated end-to-end

References and Relevant Issues

  • Implements the multi-window tab drag-and-drop request from this session (no public issue filed)

Detailed Description of the Pull Request / Additional comments

This branch is split into four reviewable commits:

  1. 1b5b1a0 extracts reusable tab insertion-index helpers and covers them with focused unit tests.
  2. f31d8a5 implements the product-side multi-tab drag/drop plumbing and LocalTests coverage.
  3. 3382c4d stabilizes the tab LocalTests so the new drag scenarios fail diagnostically instead of flaking.
  4. 278af5c adds the test-only tab-range selection hook plus the UIA harness/smoke coverage for real cross-window drag/drop.

Product behavior covered by this PR:

  • Dragging a single tab out of its window creates a new top-level terminal window.
  • Dragging multiple selected tabs out of a window keeps the dragged block together.
  • Dropping a dragged tab block onto an existing window inserts the moved tabs after the drop target.
  • The moved tabs preserve their source order after the attach.
  • The source window loses the moved tabs after a successful attach.

The UIA smoke also guards against the false-positive path I hit while recording: if dropping DragTabB + DragTabC onto DragTabA creates a new top-level DragTabB window instead of merging into the destination window, the test now fails explicitly.

Video preview

UIA drag demo preview (2x)

2x MP4: uia-drag-demo-primary-fixed-2x.mp4

Release asset page: multitab-drag-uia-demo-20260324

Validation Steps Performed

  • Built TerminalApp.UnitTests and ran *TabDragDropHelpersTests* (5/5 passed).
  • Built TerminalApp.LocalTests / TestHostApp and reran:
    • TerminalAppLocalTests::TabTests::TryInitializePage
    • TerminalAppLocalTests::TabTests::CreateTerminalPage
    • TerminalAppLocalTests::TabTests::TrackSelectedTabsVisualState
    • TerminalAppLocalTests::TabTests::MoveMultipleTabsAsBlock
    • TerminalAppLocalTests::TabTests::BuildStartupActionsForMultipleTabs
    • TerminalAppLocalTests::TabTests::AttachContentInsertsDraggedTabsAfterTargetIndex
  • Rebuilt CascadiaPackage.wapproj, refreshed the unpackaged terminal layout, rebuilt WindowsTerminal.UIA.Tests, and ran WindowsTerminal.UIA.Tests.SmokeTests.DragMultipleTabsAcrossWindows (passed).
  • Recorded the linked 2x UIA demo preview from the passing smoke flow.

PR Checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated
    • If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated (if necessary)

DevDengChao and others added 4 commits March 19, 2026 14:40
Extract reusable insertion-index helpers for multi-tab drag/drop and cover them with focused unit tests. This chunk was validated by building TerminalApp.UnitTests and running TabDragDropHelpersTests (5/5 passed).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the product plumbing and LocalTests coverage for multi-tab selection, block reordering, startup action export, and cross-window attach behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Require stable baseline tab observations in the tab LocalTests and
surface UI thread exceptions explicitly so the multi-tab drag cases
fail diagnostically instead of flaking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve multi-tab drag state through cross-window drops, add a
minimal test-only tab-range selection hook, and extend the UIA smoke
harness so it can validate tear-out and attach flows across real top-
level windows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

check-spelling found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-actions

This comment has been minimized.

@DevDengChao
Copy link
Author

@microsoft-github-policy-service agree

Rename the UIA smoke test variables that triggered check-spelling,
allow the Win32 API tokens used by the harness, and drop stale expect
entries that are no longer present in the tree.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

It's fine that you used AI to make these changes, but you should review your changes before submitting them. Your agent replaced all of the newlines with LF in TerminalPage.h/cpp and IslandWindow.h. Additionally, the TerminalApp.cs cannot be merged as-is, naturally.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@DevDengChao
Copy link
Author

Addressed the latest review feedback in 6bd43e0:

  • trimmed WindowsTerminal_UIATests/Elements/TerminalApp.cs down to the minimal multi-window/tab-drag harness we actually need
  • removed the extra diagnostics / native click / scheduled-task launch plumbing from the UIA harness
  • removed the temporary WT_UIA_DRAG_LOG / _appendUiaDragLog diagnostics from the product code
  • normalized TerminalPage.cpp, TerminalPage.h, and IslandWindow.h back to upstream line-ending style so the raw diff stays reviewable

Validation for this pass (without rerunning UIA):

  • rebuilt CascadiaPackage.wapproj through MSIX output
  • rebuilt WindowsTerminal.UIA.Tests.csproj

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 24, 2026
@lhecker lhecker changed the title Support dragging one or more tabs across windows Support for simultaneously moving multiple tabs across windows Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs-Attention The core contributors need to come back around and look at this ASAP.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants