warp icon indicating copy to clipboard operation
warp copied to clipboard

Extend pane dragging to support tab groups - vertical tabs

Open johnturcoo opened this issue 5 months ago • 1 comments

Description

This PR fixes several bugs associated with pane dragging (shown in demo below) and now handles pane dragging interactions with tab groups + pinned items.

This PR reworks vertical tab pane dragging to:

  • Decide the drop position from the cursor instead of overlapping tab drop targets (mirroring the pattern for pane dragging in htabs)
  • Make pane dragging group aware (by using the cursor position to 'hit test' groups, similar to tab dragging patterns)
  • Change rendering of tab highlights and add a catch all drop target to the whole tab panel to prevent flickering bugs

I suggest watching the demo of bugs for more context, but existing bugs:

  • dragging below all tabs in vtab bar causes flickering
  • dragging on the border of a "Over tab" / "Above tab" boundary causes flickering
  • dragging over tab groups cause flickering and it is not possible to drop into groups

How it works

The main idea is to route the cursor position to the workspace, where the tabs and tab groups live. A pane header and the per-tab drop targets only know their own local geometry, they have no access to where tab groups are laid out. So the header emits the raw drag-cursor rect (drag_position) and forwards it to the workspace. The workspace takes that drag_position and the hovered tab and, using each group's laid-out rect, resolves a BeforeTab { index, group } which captures both the index the new tab should land at and the group it's a part of (so we can differentiate dropping into a group's first/last slot vs. right before/after the group itself)

What is added in this PR and why:

  • Group hit-testing — insertion_group() compares the cursor against each group's saved container rect to tell "inside a group" from "between groups". refine_hovered_tab_index() uses this helper function and also clamps past the pinned region.
  • **Group-header drop target ** — during a drag the group header becomes a drop target so you can drop above a group or into it as the first member. Expanded groups use a splittable target (the cursor position determines if the pane will land in the group). A collapsed group uses a plain target that always resolves to "before the group".
  • Catch-all drop target — the whole panel is a fallback target so the gaps between/below groups aren't dead zones. Without it, dragging into empty space hit no target and reflowed the pane in its last dragged-over tab (the end-of-bar flicker).
  • Tab-bar axis — the drag carries a TabBarAxis so the header knows whether we are dealing with vertical or horizontal tabs
  • New indicators for tab groups — tab groups now render an above indicator, allowing panes to be dropped above collapsed/expanded groups
  • Framework change — added Container::with_foreground_border this paints a border on top of a container without changing the layout. This prevents the existing flickering bug when dragging over a boundary, since a moving layout can cause mouse position to repeatedly swap between two states. Visually this keeps the same desired border highlight without the flickering bugs.

Linked Issue

https://linear.app/warpdotdev/issue/APP-4724/update-tab-groups-to-support-dragging-a-pane-into-them

Testing

  • [x] I have manually tested my changes locally with ./script/run
  • [x] Verified that pane dragging within a window remains unchanged
  • [x] Verified pane dragging into tab groups behaves as expected

Screenshots / Videos

Demo of bugs

Demo of fix

johnturcoo avatar Jun 25 '26 20:06 johnturcoo

@johnturcoo

I'm starting a first review of this pull 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[bot] avatar Jun 25 '26 20:06 warp-for-oss[bot]