warp icon indicating copy to clipboard operation
warp copied to clipboard

Dragging bug fixes for tab groups

Open johnturcoo opened this issue 5 months ago • 0 comments

Description

This PR addresses a few bugs with dragging for tab groups including the following:

  1. Dragging a small group or collapsed group past a larger group caused flickering
  2. Dragging a tab into the first/last position of a tab group slowly caused a flicker for 1 frame
  3. Dragging into the last position of a tab group for vertical tabs was practically impossible

How it works

How I fixes the bugs in order:

  1. Modified the logic for on_group_drag() so that dragging past another group only initiates a swap when past that groups midpoint. This is how vtabs handle tab swaps when tabs are of variable size (pane view). This was done by adding a new helper group_swap_threshold_rect() that fetches the position of the tab group itself, rather than the neighboring tab.
  2. Modified the logic for on_tab_drag(), specifically the branch where a tab is being added to a new group. The calculation assumed the tab was accounted for in the group range, however the group range was fetched before adding the tab to the group. This caused the new tab index to be off by one (it was instantly updated on the next frame, causing the flicker)
  3. Modified target_group_at_axis() to make the margin for entering a group from below slightly smaller (more reactive). Also fixed the bottom padding for tab groups to match the right side padding, which slightly affects the tab group "hit box".

Linked Issue

https://linear.app/warpdotdev/issue/APP-4757/dragging-group-threshold-change-for-swap

Testing

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

Screenshots / Videos

Demo of bugs

Demo of fix

johnturcoo avatar Jun 24 '26 22:06 johnturcoo