Skip to content

Support dragging tab groups between windows - #14415

Closed
2solarmax wants to merge 40 commits into
warpdotdev:masterfrom
2solarmax:2solarmax/gh14152-group-cross-window-drag
Closed

2solarmax wants to merge 40 commits into
warpdotdev:masterfrom
2solarmax:2solarmax/gh14152-group-cross-window-drag

Conversation

@2solarmax

@2solarmax 2solarmax commented Jul 28, 2026 •

Copy link
Copy Markdown

Description

Drag a whole tab group by its header out of the tab bar to detach it into a new window, or onto another window's tab bar to move it there. The group keeps its name, colour, collapsed and pinned state and its membership, and every member keeps its running session and panes. Works from both the horizontal tab bar and the vertical tabs panel.

Stacked on #14347. That PR fixes source cleanup for single-tab drags, which the group path builds on; both branches touch the same cleanup region and independently added tab_index_for_pane_group_id. The first four commits here are #14347. Merge that first and this rebases to just the group work.

How it works

DragSource gains a GroupWindow variant carrying the group id, the member pane-group identities and an optional preview window. The preview is optional because a group can span every tab in its window: there is then nothing left behind, so the source window is itself the floating preview, exactly like a single-tab drag. source_was_single_tab became source_is_own_preview, which is what every call site actually meant.

Cleanup keys off member identity, never an index range. The source tab list can change while a drag is in flight, and a stale range removes tabs that are still in bounds. Removal goes through remove_tab_without_undo per member rather than draining the vector, so each removal still clears the detail sidecar, prunes the MRU order, and prunes the group with its last member.

Ordering is load-bearing at detach and at handoff: every member's view tree moves before any tab list is touched, in one update with no repaint in between, so no render observes the group split across two windows. Members that are still in flight are filtered out of Workspace::snapshot by identity — that filter was scalar, and snapshotting a tab whose view is being updated in another window panics rather than returning None.

One resolver, resolve_group_drop_index, owns the landing index for both the ghost slot and the commit, so they cannot diverge. It applies all three clamps the per-tab insert applies, including clamp_past_group — without that, a group dropped inside another group's run would split it.

Relationship to #14164

This supersedes the open draft #14164 on the same issue. Some of what is here came from working out why that approach did not hold: it removes source tabs positionally by {index, count}, has no put-back path, and leaves reverse_handoff and on_drag_while_inserted at arity 1. Its group-aware preview rect idea is right and is kept in spirit.

Linked Issue

Fixes #14152 (ready-to-implement).

  • The linked issue is labeled ready-to-spec or ready-to-implement

Testing

Four new integration tests drive the real app with synthetic mouse events, alongside the five existing single-tab drag tests:

test ui_tests::test_detach_tab_group_to_new_window_with_drag        ... ok
test ui_tests::test_detach_tab_group_to_new_window_in_vertical_tabs ... ok
test ui_tests::test_attach_tab_group_to_other_window                ... ok
test ui_tests::test_whole_window_tab_group_attaches_to_other_window ... ok
test ui_tests::test_tab_group_drag_back_to_source_cancels           ... ok
test ui_tests::test_detach_tab_to_new_window_with_drag              ... ok
test ui_tests::test_attach_tab_to_other_window_and_continue_drag    ... ok
test ui_tests::test_single_tab_handoff_continues_drag               ... ok
test ui_tests::test_multi_tab_drag_back_to_source_and_out_again     ... ok
test ui_tests::test_reorder_tabs_with_drag                          ... ok
test result: ok. 10 passed; 0 failed
cargo test -p integration --features drag_tabs_to_windows --test integration -- drag tab_group vertical_tabs whole_window

These are invisible to default CI. They are gated on drag_tabs_feature_enabled, and ci.yml runs the workspace without --features, so the whole group suite silently skips there. Flagging that rather than letting a green tick imply coverage. The drag-model state is therefore also unit-tested ungated in cross_window_tab_drag_tests.rs, and the model-level behaviour — drop-index resolution across the pinned boundary and into an existing group, contiguity after insert, identity cleanup after a mid-drag shift, non-contiguous refusal — in view_tests.rs.

Also run:

  • ./script/format --check — clean
  • cargo clippy -p warp -p integration --all-targets --tests --features integration/drag_tabs_to_windows -- -D warnings — clean
  • cargo test -p warp --lib — 13 failures, the same set that fails on pristine master on this machine (OpenAI key, notebooks fs, telemetry, terminal, path resolution). None in drag or group code.

The whole-window case has its own test because every other group test leaves one tab ungrouped, so that path was structurally unreachable in the suite — and getting it wrong destroys the members that are not transferred.

  • I have manually tested my changes locally with ./script/run

Driven against a local build with synthetic mouse events, which is the same gesture path the integration tests exercise; stills below. test_video_recording is #[ignore = "Manual test: requires real display for frame capture"] and still times out per frame when run un-ignored on a real display, so the in-harness capture path was not available for a recording. Build with ./script/run --features drag_tabs_to_windows; the flag is not in the default set, so a plain ./script/run produces a binary where this path is unreachable. Grab a group by its header — grabbing a member drags just that tab, which is what with_defer_to_handled_child_mouse_down is for.

Screenshots / Videos

Before / mid-drag / after, on a local --features drag_tabs_to_windows build, posted in a comment below: #14415 (comment)

The mid-drag frame is the one that matters — the group sits in the floating preview with both members while its slot in the source panel has collapsed, so it is moving as a unit rather than a member at a time.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-NONE

2solarmax added 30 commits July 27, 2026 21:13
A cross-window tab drag recorded the source tab's INDEX when the drag
started, and the drop removed whatever sat at that index. Nothing kept the
index in step with the source window's tab list, so anything that closed a
tab mid-drag shifted the list and the drop removed a bystander, while the
dragged tab stayed behind and was then live in two windows at once.

A shell exiting is enough to trigger it: PaneGroup::Event::Exited reaches
handle_file_tree_event and closes that tab. cmd-W and another window handing
a tab off do the same.

The existing guard only bounds-checked the index, which does not help: after
a shift the stale index is usually still in bounds and simply points at the
wrong tab. The log::warn! for a stale index shows the staleness was
anticipated, but only the out-of-bounds half was handled.

ActiveDrag now captures the dragged pane group's EntityId at drag start, and
the three source-cleanup DropResult variants carry that id instead of an
index. Workspace resolves the tab at drop time via
tab_index_for_pane_group_id and skips cleanly if it is already gone. Dropping
the index from those variants makes the stale-index path unrepresentable
rather than merely guarded.

Regression test seeds a four-tab window, closes tab 0 mid-drag, and asserts
the dragged tab is removed and the bystander survives. It fails on master.
Follow-up on the same invariant, from reviewing the first commit.

The put-back branch of perform_handoff still resolved the source tab by the
drag-start index, so dropping a tab back onto its own window's tab bar kept
the original bug: it unsubscribed and removed a bystander, left the dragged
tab's placeholder in place, and then re-inserted the real tab, leaving two
TabData rows pointing at one pane group in one window.

Placeholder rendering and the window snapshot read the same frozen index, so
after a mid-drag tab close an innocent tab rendered at zero width and a
save_app during the drag persisted a snapshot that omitted a bystander. Both
now resolve through the pane group id; the drag model still decides WHETHER
to collapse or skip, only the WHICH is resolved by identity.

Removing the last remaining tab needed its own path. remove_tab treats the
last tab as 'close the window' with a bare ctx.close_window(), which leaves
suppress_detach_panes_on_window_close false, and on_window_closed would then
detach the panes of a pane group that now lives in the target window. That
was previously unreachable because the stale index was usually out of bounds
and the removal was skipped; resolving by identity reaches it, so this path
closes the same way the other content-transfer paths do.

Also drops a duplicated allow(clippy::too_many_arguments) that would have
failed CI under -D warnings.

Tests: identity is captured by both begin_*_drag entry points; the last-tab
drop suppresses pane detach; a drop whose tab already vanished removes
nothing.
The identity helper was inserted between handle_drop_result's doc comment
and the function, so the comment described the wrong thing and
handle_drop_result was left undocumented. Also drops the helper to private,
since both callers are in this file, and renames an index binding that read
like a TabData.
mock_workspace leaves the window at WindowBounds::Default, for which
AppContext::window_bounds returns None. CrossWindowTabDrag::on_drag bails
early on that, so any cross-window drag test built on mock_workspace passes
without reaching the drag machinery at all.

mock_workspace_at takes an explicit rect. The accompanying test asserts both
halves - that the new helper resolves bounds and that the default one does
not - so the distinction cannot silently regress and quietly turn every
cross-window test green for the wrong reason.
Introduces DragSource::GroupWindow carrying the group id, the run's first
index, the member pane-group identities, and an optional preview window.

preview_window_id is Option because a group can span every tab in the source
window. There is then nothing left behind, so the source window is itself the
floating preview and no view transfer happens at drag start - the same shape
as SingleTabWindow. Making it Option is what lets that case exist without a
second variant.

Replaces the source_was_single_tab predicate with source_is_own_preview,
which is what every call site actually meant: is there a separate preview to
promote or close, and should the source window be closed rather than have
tabs removed. A whole-window group drag answers the same as a single-tab
drag, which a literal 'was single tab' test would have got wrong.

Adds source_kind() returning a DragSourceKind enum so decision sites can
match exhaustively rather than branch on a pair of booleans, plus accessors
for the group id and member identities. The two accessors that were already
real matches now fail to compile until the new variant is handled, which is
the compiler help this shape buys.
Workspace::snapshot filtered a single transferred_tab_index because the
single-tab drag only ever has one tab in flight. A group drag has N, and
snapshotting a tab whose view is being updated in the target window resolves
a handle that no longer lives here - which panics rather than returning None,
the failure shape behind the open pane-view crash.

The filter is now a set. For a group it is resolved by pane-group identity
rather than by the drag-start indices, which go stale if the source tab list
shifts mid-drag; single-tab drags keep their existing one-element behaviour.

Adds Workspace::tab_indices_for_pane_group_ids, which the cleanup paths will
share.
The single-tab insert applies its clamps inside
insert_transferred_tab_at_index. A group cannot do that: the ghost slot has
to be drawn where the members will actually land, so the index must be
resolved before inserting and both callers must share the resolution.

resolve_group_drop_index applies all three clamps the single-tab path does -
bounded by length, the correct side of the pinned boundary, and pushed past
any group run it would land inside. That last one is what stops a dropped
group from splitting an existing group in the target window, which every
group_member_index_range caller assumes cannot happen.

post_drain_index maps an insertion index computed before a contiguous run is
drained to the equivalent index after. Subtracting a flat run length
under-shoots by up to len-1 for an index strictly inside the run, where the
answer is the run's start - a block cannot be inserted into itself.

Tests cover the split case at a run's interior and both outer edges, the
pinned boundary in both directions, and the straddle window.
Adds TransferredTabGroup (group metadata, members in tab-bar order, and the
member pane-group identities) and the read-only snapshot that builds it.

The snapshot refuses a non-contiguous run. group_member_index_range returns
the span between the first and last match and only assumes contiguity, so
capturing that span on a broken run would sweep bystanders into the payload
and hand them to another window.

Three DropResult variants carry the members as identities rather than an
index range, because the source tab list can shift mid-drag and a stale range
removes tabs that are still in bounds. All three are registered with
register_pending_source_close where they close a window, so is_active() stays
true until the close actually lands - otherwise save_app runs while two
workspaces still reference the same pane groups and writes a duplicate
terminal_panes.uuid.

Source cleanup goes through remove_tab_without_undo per member, descending,
rather than draining the vector: each removal still clears the vertical-tabs
detail sidecar, prunes the MRU order, and prunes the group once its last
member leaves. When the members are everything the window has left it closes
the content-transfer way instead, since remove_tab would otherwise close with
pane detach unsuppressed and tear down pane groups that now live elsewhere.

Tests: non-contiguous refusal, identity cleanup after a mid-drag shift,
already-gone members, and the take-everything close.
create_transferred_group_window routes the first member through
create_transferred_window, so the preview is constructed by exactly the same
placeholder path a single-tab drag uses, then transfers the remaining
members' view trees and appends them.

Every view tree moves before the new window's tab list is touched, so the
list never references a pane group whose views still live in the source
window - that mismatch is what resolves a handle to the wrong window and
panics during the next render.

Returns Option rather than the window id unconditionally. Reporting success
when only the first member actually moved would have the caller remove N tabs
from the source while N-1 pane groups were still there.

adopt_transferred_group_members appends members 1..N, stamps the placeholder
member's group_id, registers the group, and activates once at the end. The
per-tab insert path activates on every call, which for a group would close
the command palette, close the agent view and retitle the window N times.
insert_transferred_tab_group_at_index takes an index already resolved through
resolve_group_drop_index and does not re-clamp. The per-tab insert clamps
internally, which would push a pinned group back out of the pinned prefix and
land the block somewhere other than where its ghost was drawn.

One splice rather than a loop, so the pinned boundary is not re-evaluated
part-way through, and the group is registered only afterwards so anything
reading tab_groups during the splice still sees the pre-insert state.
Activates once at the end.

Members land with pinned = false because group pinning is the source of
truth, and the group's draggable_state is reset - sharing the source's would
leave one live drag state bound to two elements in two windows.
on_group_drag was a pure in-window reorder: no detach test, no detached
marking, no forward to the cross-window drag model. It now mirrors
on_tab_drag - forward to the model when a drag is already in flight, else
detach once the drag leaves the tab bar on its perpendicular axis, using the
same rects and sensitivity so both gestures feel the same.

Ordering in the detach is load-bearing. The payload is captured while it is
still only a read, so a failure there unwinds nothing. Members are marked
detached, then the preview window is created and every member's view tree
moves into it within one update with no repaint in between, so no render can
observe the group split across two windows. The source tab list is not
mutated here: members stay as detached placeholders and are removed at drop
time, which keeps the list consistent with view ownership at every render
boundary during the drag.

A group that spans every tab takes the no-transfer path instead, repositioning
the source window as its own preview exactly like a single-tab drag.

If preview construction fails the detached flags are cleared again, otherwise
those tabs would stay undraggable for the rest of the session. When the active
tab went with the group, focus moves to a surviving neighbour.
DropGroup previously sent telemetry and repainted; it never reached the drag
model, so a detached group had no way to finish its gesture. It now mirrors
DropTab: clear is_tab_being_dragged, clear the per-tab detached flag on every
member that was not handed off - on every path, including an aborted drag,
since a stuck flag makes those tabs undraggable for the rest of the session -
then run on_drop and hand the result to handle_drop_result.

StartGroupDrag now sets is_tab_being_dragged like StartTabDrag, so the tab bar
renders its dragging state for a group drag too.

Both group draggables drop their axis lock when cross-window drag is enabled.
DragAxis pins the perpendicular axis to the laid-out origin, so with the lock
on the detach hit-test could never fire and a group could only ever be
reordered in place. Adds Draggable::with_optional_drag_axis so the decision
can be made inline instead of splitting the builder chain.
finalize_preview_as_new_window and finalize_handoff both returned the
single-tab cleanup variants, which carry an index. For a group drag that
would have removed one tab at a stale position instead of the members.

Both now branch on whether the drag carries member identities and return the
group variants, which the source resolves by identity at drop time. A group
that took every tab still closes its source window rather than removing tabs
from it, which is what source_is_own_preview answers.
execute_handoff_multi_tab_to_other only knew how to move the preview's tab 0.
For a group drag that moved one member and left the rest in the preview.

The group branch snapshots the whole group out of the preview, unsubscribes
every member, transfers all their view trees before the target's tab list is
touched, and inserts them as one block at an index resolved through
resolve_group_drop_index - the same resolver the ghost slot uses, so the
block lands where the ghost said it would and cannot split a group already in
the target.
reverse_handoff cleared the preview's tab list and re-inserted a single tab.
Run against a group that had already been inserted into the target, it would
have dropped N-1 TabDatas without unsubscribing them and stranded those
members in the target window.

The group path snapshots the block out of the target, unsubscribes every
member, transfers all the view trees back to the preview, then removes the
members from the target by identity in descending index order so earlier
indices stay valid. The preview is rebuilt as a group rather than as a bare
tab, so leaving and re-entering a target window round-trips cleanly.
The zero-width placeholder collapse was only applied to the Single slot arm,
so a group detached into a preview window kept rendering at full width in the
source bar while also showing in the floating preview.

The Group arm now collapses the same way, matched by group identity rather
than by the drag's frozen first index - that index stops pointing at this run
if the source tab list shifts mid-drag, and would then blank an unrelated
group.
on_drag_while_inserted moved a single tab with a flat -1 index adjustment.
Applied to an inserted group that pulls one member out of the run, splitting
it, and the -1 lands the block short whenever the cursor index sits inside
the run being moved.

The group path removes the members by identity, descending, and splices them
back as one block at an index mapped through post_drain_index, which resolves
the straddle case to the run's start rather than under-shooting.

Also drops DragSourceKind and source_kind: dispatch ended up keying on group
identity instead, so they were dead. Deleting beats an allow(dead_code). The
Window postfix lint now fires with three variants, so it carries an explicit
allow - each variant names what acts as the preview window, which is the
point of the suffix.
Mirrors test_detach_tab_to_new_window_with_drag, which drives a real
cross-window tab drag with synthetic mouse events, so the group gesture gets
the same level of coverage rather than being manual-only.

Builds a three-tab window, groups the second and third, then presses on the
group header, drags clear of the tab bar on the perpendicular axis and
releases. Asserts the source window is left with just the ungrouped tab: both
members left together and the group went with them.

Leaving one tab ungrouped is deliberate - it exercises the path where the
source window survives the detach, which is the one with a dedicated preview
window and real view transfers.

Adds Workspace::tab_groups_for_test and a local copy of the group
position-id format, matching how the harness already defines
tab_position_id locally rather than widening crate-private items.
Registers test_detach_tab_group_to_new_window_with_drag in the ui_tests list
so it actually runs, and corrects where it presses: only the whole group
container has a save position, and the header is the first element inside it,
so the container centre sits over a member tab. Pressing there let the nested
per-tab draggable claim the mouse-down and started a TAB drag - the app was
right, the test was aiming wrong.

With the press point corrected the real app now reports begin_group_drag with
both members and a dedicated preview, and the detached window ends up holding
both members, so the group moves as a unit.

Adds an assertion on the detached window before checking the source, matching
how the single-tab test sequences its window focus, plus logging around
source cleanup while a remaining discrepancy in the source tab count is
pinned down.
focus_saved_window only changes OS focus; assert_tab_count does not follow
it. The existing single-tab test cannot expose that because both its windows
end up with one tab, so the assertion passes either way. A group drag leaves
different counts on each side, which made it visible.

The test now reads each workspace by its saved window id and asserts the
detached window holds both members, the source keeps only the ungrouped tab,
and the group is pruned from the source.

Verified on the real app: begin_group_drag fires with both members and a
dedicated preview, the members land together in the new window, and the
source cleans up by identity. All six drag integration tests pass, including
the five pre-existing ones, so the shared drag path is unregressed.
Second gesture, driven on the real app: detach the group, move over the other
window's tab bar, release. Asserts the target gains both members as one group
and the source keeps only its ungrouped tab with the group pruned.

The two windows are separated vertically as well as horizontally. With both
tab bars at the same y, the point that maps onto the target's tab bar can
still land inside the source window's own tab-bar rect; the drag then resolves
to ReorderInSource and puts the group back, which is correct behaviour but
not what this test is exercising.

All seven drag integration tests pass together, so both group gestures work
alongside the five pre-existing single-tab ones.
The cross-window ghost chip rendered the preview workspace's first tab, so a
group drag showed a single tab floating under the cursor while N tabs were
actually moving.

render_group_for_drag_ghost lays every member out along the axis the source
used. Each member still goes through render_tab_for_drag_ghost, which uses
TabComponent::for_drag_ghost() and therefore skips the outer SavePosition,
Draggable and DropTarget wrappers - so the chip cannot pollute the target
window's position cache, which is what that path exists to prevent.

The chip is already constrained to the source element's rendered size, and
detach captures that from the group container rect, so the chip matches the
block the user grabbed.
execute_handoff_back_to_caller moved only the preview's first tab back, so a
group dropped onto its own tab bar returned one member's view and left the
rest in the preview. It now transfers every member and maps the insertion
index back through the placeholder run length rather than a flat -1.

Adds the put-back integration test. It currently FAILS on its last assertion:
the source ends with all three tabs and the group record intact, but only one
tab still carries the group id, so one member comes back ungrouped. The
transfer half is fixed; re-associating both placeholders with the group is
not, and that is the remaining defect.

The test also needed its window pinned away from the others - integration
tests share a process, so windows from earlier tests are still present and
the drag was resolving onto one of them (GhostInTarget on an unrelated
window) instead of coming home. With the window pinned the trace shows the
intended ReorderInSource then DropInto on the source.
The put-back path removed one source tab and inserted one transferred tab.
For a group that dropped a member out of the group: the tab count looked
correct while one member came back ungrouped, because the re-inserted tab was
built by the per-tab insert, which sets no group_id.

A group needs none of that. Its placeholders never left this window, still
carry their group_id, and execute_handoff_back_to_caller has already brought
every member's view tree home - so they simply own their views again. The
group branch short-circuits before the remove-and-reinsert and just restores
drag state.

All eight drag integration tests now pass on the real app, including the
three group gestures and the five pre-existing single-tab ones.
The vertical panel uses a different draggable from the horizontal bar, so
the gesture needed its own coverage rather than being assumed equivalent.
Detaches a group from the vertical panel and asserts both members land in the
new window while the source keeps its ungrouped tab.

Aims near the top edge of the group container: like the horizontal bar, only
the container has a save position and the header is its first row, so the
centre sits over a member and starts a tab drag. The vertical panel is tested
on its X axis, so the detach moves sideways out of the panel.

Note on scope: the vertical panel has no zero-size placeholder collapse for
detached tabs at all today - collapsed_source_placeholder_index has only a
horizontal consumer - so a detached group rendering at full height there
matches existing single-tab behaviour rather than regressing it. Adding one
only for groups would make the two inconsistent.
A group containing every tab in its window has no dedicated preview - the
window itself is the preview - so perform_handoff took the no-preview branch,
which had no group case. It moved ONE member across as an ungrouped tab, and
finalize then closed the source with pane detach suppressed, tearing down the
remaining members' live shells with no cleanup and no undo.

Every existing group test deliberately leaves one tab ungrouped, so this path
was never exercised. Adds a test whose group spans the whole window and
asserts both members arrive in the target, still grouped - losing one means
its shell was destroyed.

Also resets the group's DraggableState in adopt_transferred_group_members.
It is a shared Arc, so the preview window was binding a second Draggable to
the source's live drag handle, and its on_drop would dispatch DropGroup into
the preview workspace. The sibling insert path already guarded this; the
detach path, which is the common one, did not.

And clears suppress_overlay_paint on the dragged group in DropGroup. The
existing clears all operate on a TAB's DraggableState; a group has its own,
so after a whole-window group drag the header's overlay stayed suppressed for
the rest of the session and the flag travelled with the group.
The floating chip was made group-sized but the insertion slot was not, so the
target's tab bar opened a one-tab gap while an N-tab block was about to land
in it. Both slot renderers read the height or width of tab_position_id(0),
which is a single tab.

GhostState now carries member_count - 1 for a tab, the member count for a
group - and both the horizontal and vertical slot renderers multiply their
measured tab size by it.

Also rewrites the contiguity test, which was asserting a tautology. It built
the expected index range locally and then checked that range against itself,
so it held even if insert_transferred_tab_group_at_index were deleted. It now
inserts into a SECOND workspace, which is the real shape of the feature and
leaves exactly one run carrying the group id, and asserts the members' actual
positions equal the resolved range - which covers contiguity, count and
landing position in one assertion that fails if the splice regresses.
The ghost index went through tab_insertion_index_for_cursor, which applies
clamp_to_unpinned_region unconditionally, while the drop resolved through
resolve_group_drop_index. For a PINNED group those disagree: the indicator
appeared in the unpinned region and the block landed in the pinned prefix.

group_insertion_index_for_cursor resolves through the same function the
commit uses, and cross_window_attach_target takes the dragged group's pinned
flag so the ghost and the landing position cannot diverge.

The flag is threaded through DragSource::GroupWindow and passed as a
parameter rather than read from the drag model inside the resolver. Reading
it there re-borrows the singleton from inside CrossWindowTabDrag::update,
whose downcast then fails and panics - which is exactly what happened on the
first attempt and took out both cross-window attach tests.

Also handles DragResult::ReorderInSource for groups. It was returned for
group drags but on_group_drag only matched AdjustDraggable, so hovering a
detached group back over its own tab bar reordered nothing in place. It now
moves the whole placeholder run and reports its new start, and
set_source_placeholder_index updates GroupWindow rather than silently
no-opping on it.
tab_groups_read and grouped_tab_count are now gated on the integration_tests
feature, so they do not exist in a normal build. They were unconditionally
public methods on a production type, and one leaked an internal collection
type permanently.

Also moves the identity-helper doc block back onto the function it describes.
Inserting grouped_tab_count between that comment and
tab_indices_for_pane_group_ids left one function mis-documented and the other
with no docs at all - the same slip that had to be fixed in the single-tab
cleanup PR.

@warp-for-oss warp-for-oss Bot left a comment

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.

Overview

This PR adds cross-window dragging for whole tab groups, including preview-window handling, group-aware handoff/reverse-handoff logic, horizontal and vertical tab bar rendering updates, and integration/unit coverage for the new gesture paths.

Concerns

  • The whole-window group handoff path transfers and unsubscribes the source group before confirming the target workspace still exists; if the target disappears between target resolution and commit, the reset path cannot restore the source window and the dragged sessions can be left without a valid workspace.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/workspace/view.rs Outdated
ctx.transfer_view_tree_to_window(*id, caller_window_id, target.window_id);
}

let Some(target_workspace) =

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.

⚠️ [IMPORTANT] Resolve target_workspace before calling prepare_for_transferred_tab_attach and transfer_view_tree_to_window above. If the target window closes between target selection and this commit, this branch has already unsubscribed the source group and moved every view tree, then reset_to_floating() cannot put the source window back together, leaving the dragged sessions detached from any workspace.

The whole-window group handoff unsubscribed every member and moved their view
trees, and only then looked up the target workspace. That window is its own
preview, so once the members are unsubscribed and transferred there is
nothing to fall back to - a bail after that point left the dragged sessions
without a workspace.

The lookup now happens first, so the reset path still has an intact source to
return to. Matches execute_handoff_multi_tab_to_other, which already resolved
its target up front.

Reported by Oz on warpdotdev#14415.
@2solarmax

Copy link
Copy Markdown
Author

Good catch, fixed in 4e28d4c.

The whole-window branch unsubscribed every member and moved their view trees before looking up the target workspace. That window is its own preview, so past that point there is nothing to fall back to and a bail leaves the sessions without a workspace. The lookup now happens first, so the reset path still has an intact source to return to — matching execute_handoff_multi_tab_to_other, which already resolved its target up front.

All 10 drag integration tests still pass, clippy and format clean.

/oz-review

@warp-for-oss

warp-for-oss Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

@2solarmax

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

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.

Overview

This PR adds cross-window drag support for whole tab groups, including preview-window transfer, source cleanup by pane-group identity, horizontal/vertical tab rendering updates, and integration/unit coverage for detach, attach, and put-back flows.

Concerns

  • After a group is handed off into a target window, the continued-drag path moves the group run but still refreshes only a member tab's drag state. Group rendering uses the group-level DraggableState, so the inserted group can stop rendering as the active dragged item while the mouse is still down, breaking continued drag/reorder/reverse interactions in the target.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

}
block.reverse();
let at = target_index.min(workspace.tabs.len());
workspace.tabs.splice(at..at, block);

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.

⚠️ [IMPORTANT] Group handoffs insert the block here, but the existing drag-state refresh below still calls workspace.tabs[current_target_index].draggable_state.set_dragging(...). Group rendering keys off tab_groups[group_id].draggable_state, so after a handoff the group stops rendering as the dragged element while the mouse is still down. When member_ids is non-empty, refresh the transferred group's draggable_state instead of a member tab's state.

@2solarmax

Copy link
Copy Markdown
Author

This latest review ran on 4e28d4c5, which is the commit that fixed it, but it repeats the same finding — so I think it's a stale read rather than a live issue. The order on the current head is:

  • view.rs:28494-28502 — resolve the target workspace, bail to reset_to_floating if it's gone
  • view.rs:28507-28510 — only then unsubscribe each member
  • view.rs:28514 — and only then move the view trees

So the bail happens while the source is still fully intact and still owns its sessions. That was exactly the concern and it was the point of the change; nothing is unsubscribed or transferred before the lookup any more.

I'd rather not spend the last /oz-review re-running it on an unchanged tree, so flagging for a human instead.

@oss-maintainers — could someone take a look? The PR is otherwise clean: 10 drag integration tests passing on a local build (4 new for the group gestures plus the 5 existing single-tab ones, all green together), ./script/format --check and cargo clippy -p warp -p integration --all-targets --tests --features integration/drag_tabs_to_windows -- -D warnings both clean, and manual-testing stills a few comments up.

One thing worth a maintainer's eye rather than a bot's: this is stacked on #14347, which fixes the same source-cleanup path for single-tab drags. That one is still waiting on a readiness label for #14346. If you'd rather see them as one PR, or want #14347 landed first, happy either way.

…-group-cross-window-drag

# Conflicts:
#	app/src/workspace/view_tests.rs
@2solarmax

Copy link
Copy Markdown
Author

Rebased onto current master (was 108 behind, and had gone conflicting). Back to mergeable at 85c3f864.

The conflict was additive only — upstream added two test_open_new_window_for_team_* tests next to my mock_workspace_at helper in view_tests.rs; both sides kept. All 10 drag integration tests still pass after the merge, and format/clippy are clean.

Still looking for a human pass on this whenever someone has a moment — the last Oz review repeated a finding that the reviewed commit had already fixed (details a couple of comments up), so I've left the third /oz-review unspent rather than re-run it on an unchanged tree.

@2solarmax

Copy link
Copy Markdown
Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

@2solarmax

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

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.

Overview

This PR extends cross-window tab dragging to whole tab groups, including preview/ghost rendering, source cleanup by pane-group identity, horizontal and vertical tab-bar behavior, and targeted unit/integration coverage. The implementation includes visual evidence in the PR description and no material spec context was provided.

Concerns

  • One newly added doc-comment block is attached to the wrong helper and now documents grouped_tab_count with unrelated pane-group index/cleanup text.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/workspace/view.rs Outdated
/// Performs the source-workspace cleanup indicated by `DropResult`.
/// Cross-workspace mutations (preview/target updates, focus) happen inside
/// `CrossWindowTabDrag::on_drop`; this method only touches `self`.
/// Indices of the tabs whose pane group is in `pane_group_ids`, ascending.

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.

⚠️ [IMPORTANT] These doc lines are attached to grouped_tab_count, so its generated docs now describe pane-group indices and cleanup instead of the helper. Move/remove the stray lines so the doc comment accurately describes this function.

Oz's third review round found that grouped_tab_count carried a doc block
belonging to handle_drop_result plus an orphaned fragment of the
tab_indices_for_pane_group_ids doc. Restore each doc to its own function:
handle_drop_result gets its cleanup-scope doc back, tab_indices_for_pane_group_ids
keeps its identity-semantics doc, and grouped_tab_count keeps only its own
integration-test gating note.
@2solarmax

Copy link
Copy Markdown
Author

Fixed in ebdf331 — the doc block for handle_drop_result had drifted onto grouped_tab_count along with a truncated fragment of the tab_indices_for_pane_group_ids doc. Each doc now sits on its own function. Suite and clippy still green.

@2solarmax

Copy link
Copy Markdown
Author

/oz-review

@warp-for-oss

warp-for-oss Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

@2solarmax

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

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.

Overview

This PR extends cross-window dragging from single tabs to whole tab groups, including preview-window handling, source cleanup by pane-group identity, horizontal/vertical rendering, and integration/unit coverage.

Concerns

  • Group-aware insertion-index resolution is not applied on the ordered-window targeting path, so normal dedicated-preview group drags can still compute their ghost/drop target with the single-tab resolver.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

workspace.tab_insertion_index_for_cursor(window_id, cursor_position_on_screen, ctx)
});
let insertion_index =
workspace.read(ctx, |workspace, ctx| match dragged_group_pinned {

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.

⚠️ [IMPORTANT] This group-aware resolver only runs in the fallback workspace loop; when the preview window is in ordered_windows, the earlier branch still returns via compute_insertion_index_for_window(), which uses tab_insertion_index_for_cursor(). Dedicated-preview group drags normally hit that branch, so drops over pinned tabs or inside another group can draw the ghost at a different index than the commit path resolves. Thread dragged_group_pinned through that branch/helper too.

…ting route

Oz review round 3: the ordered-window route (preview in the z-order) and the
source-window route of cross_window_attach_target resolved their drop index
through the plain single-tab resolver, so a group drag hovering another
window's tab bar computed its ghost slot from the raw cursor slot — one that
the commit-time resolve_group_drop_index then corrects, so the ghost showed a
position the drop never takes (and could point inside a pinned prefix).

Fix the class rather than the two instances: compute_insertion_index_for_window
now takes dragged_group_pinned and dispatches to the group resolver itself, so
every targeting route — ordered-window, source-window, and all-workspaces —
funnels through one place and a new call site cannot silently get the
single-tab behaviour for a group drag.

The commit path already re-clamps (execute_handoff_multi_tab_to_other), so the
landing index was never wrong — only the ghost preview diverged.

Also adds test_attach_tab_group_does_not_split_target_group: a group dropped
into a target that already holds a group, asserting contiguity of both groups
plus tab/group-count preconditions (without which the run assertion passes
vacuously when the drag fails to land — caught by reverting the fix and
watching the first version stay green). Plus a gated tab_group_id_at accessor
for run assertions.
@2solarmax

Copy link
Copy Markdown
Author

Fixed in 7b63ccc. Verified the finding and scoped it precisely: the ordered-window route and the source-window route of cross_window_attach_target both resolved their drop index through the single-tab resolver, so a group drag's ghost slot was computed from the raw cursor slot. The commit path already re-clamps via resolve_group_drop_index (cross_window_tab_drag.rs execute_handoff_multi_tab_to_other), so the landing index was never wrong — the divergence was the ghost preview pointing at a position the drop never takes (including inside the pinned prefix).

Fix is the class, not the two instances: compute_insertion_index_for_window now takes dragged_group_pinned and dispatches to the group resolver itself, so all three targeting routes funnel through one place and a new call site can't silently get the single-tab behavior. Added test_attach_tab_group_does_not_split_target_group (group dropped into a target that already holds a group, with count preconditions so it can't pass vacuously). Suite 11/11, clippy clean.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @2solarmax — a reviewer requested changes on this PR and it hasn't had activity from you in 7 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 14 days of inactivity.

@2solarmax

Copy link
Copy Markdown
Author

Still here and ready for review — rebased and green as of last week (7b63cccc, 11/11 drag integration tests, clippy clean). This PR is blocked on maintainer review rather than on me, so per the contribution guidelines could a maintainer apply no-autoclose? Happy to make any change a reviewer wants.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Hi @2solarmax — a reviewer requested changes on this PR and it hasn't had activity from you in 7 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 14 days of inactivity.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @2solarmax — final reminder: a reviewer requested changes on this PR and it has been inactive for 10 days. It will be automatically closed in about 4 day(s) unless you push updates or reply. Maintainers can apply the no-autoclose label to keep it open.

@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because the requested changes have gone unaddressed for over 14 days. If you'd like to continue, push your updates and reopen the PR (or comment to ask a maintainer to reopen) — we'd be glad to pick it back up.

@github-actions github-actions Bot closed this Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dragging/transferring tab groups between windows

1 participant