Skip to content

fix: pane separator moves at half mouse speed during drag (#6468)#9999

Open
yingxuel wants to merge 1 commit intowarpdotdev:masterfrom
yingxuel:fix/pane-resize-drag-speed
Open

fix: pane separator moves at half mouse speed during drag (#6468)#9999
yingxuel wants to merge 1 commit intowarpdotdev:masterfrom
yingxuel:fix/pane-resize-drag-speed

Conversation

@yingxuel
Copy link
Copy Markdown

@yingxuel yingxuel commented May 3, 2026

Closes #6468

Description

When dragging the pane separator, the divider moved at roughly half the speed of the mouse cursor — a 200 px mouse movement produced only ~100 px of divider movement.

Root cause: PaneBranch::adjust_pane_size called pane_size() (which returns last-rendered element bounds) on every drag event to compute the flex redistribution. Mouse drag events can fire at ~120 Hz while the app renders at ~60 Hz, meaning two events fire per render frame. Both events read the same stale rendered sizes and compute the same flex value, so the second event overwrites the first with an identical result — only one event's worth of movement is applied per frame, halving the effective speed.

Fix: Add cached_total_pixel_size: Option<f32> to DraggedBorder. On the first drag event after a render, the total pixel size of the two adjacent panes is read from the renderer (when fresh) and cached. All subsequent events in the same drag session derive individual pane sizes from the current flex ratio instead of re-reading stale rendered bounds, so each delta accumulates correctly.

Extract the redistribution math into compute_new_flex, a pure function with no ViewContext dependency, enabling unit testing.

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Screenshots / Videos

recording_6468.mov

Testing

Added 6 unit tests in app/src/pane_group/tree_tests.rs covering compute_new_flex:

  • test_compute_new_flex_single_event — basic single drag event correctness
  • test_compute_new_flex_accumulates_across_events — 3 × 10 px events yield 430 px, not 410 px
  • test_stale_size_bug_would_undercount_deltas — explicitly compares old formula (410 px) vs new (430 px) for N events before a re-render, proving the bug existed and is fixed
  • test_compute_new_flex_minimum_pane_size_respected — clamping at minimum pane size
  • test_compute_new_flex_ignores_near_zero_delta — sub-epsilon delta returns None
  • test_compute_new_flex_asymmetric_flex — asymmetric flex values (600 px / 200 px split)

Pre-existing presubmit failures (unrelated to this PR): 6 tests fail on master before applying these changes, confirmed by the PR author:

  • shell_integration_tests::test_legacy_ssh_into_bash
  • shell_integration_tests::test_legacy_ssh_into_zsh
  • shell_integration_tests::test_ssh_into_ash
  • shell_integration_tests::test_ssh_into_sh
  • ui_tests::test_ssh_with_shell_override
  • settings::init::tests::test_migration_does_not_rerun_when_marker_present

These require SSH infrastructure or specific local state not available in a standard dev environment and are not caused by this PR.

Agent Mode

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

…#6468)

adjust_pane_size read pane_size() (last rendered bounds) on every drag
event. When multiple events fire between render frames the stale sizes
caused every event after the first to overwrite the flex values with the
same result, effectively halving the resize speed.

Fix: cache the sum of the two adjacent panes' pixel sizes on the first
drag event (when the render is fresh) via cached_total_pixel_size on
DraggedBorder. Subsequent events derive individual sizes from the
current flex ratio instead of re-reading stale rendered bounds, so
each delta accumulates correctly.

Extract compute_new_flex as a pure function so the math can be unit
tested without a ViewContext. Add 6 regression tests including one that
explicitly demonstrates the old stale-size behaviour producing half the
expected movement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 3, 2026

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @yingxuel on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment @cla-bot check to trigger another check.

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 3, 2026

@yingxuel

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

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 3, 2026
@yingxuel
Copy link
Copy Markdown
Author

yingxuel commented May 3, 2026

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label May 3, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented May 3, 2026

The cla-bot has been summoned, and re-checked this pull request!

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 3, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Overview

This PR changes pane divider drag resizing to cache the adjacent panes' total pixel size during a drag and compute new flex values from the current flex ratio, with unit coverage for accumulated mouse deltas and minimum-size clamping.

Concerns

  • For faster review, please upload screenshots or a video of the pane separator tracking the cursor end to end. This is a user-visible interaction change, and the PR currently says there is no visual diff rather than attaching evidence.

Verdict

Found: 0 critical, 0 important, 1 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

@yingxuel
Copy link
Copy Markdown
Author

yingxuel commented May 4, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 4, 2026

@yingxuel

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

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @vkodithala.

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

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed their stale review May 4, 2026 00:45

Oz no longer requests changes for this pull request after the latest automated review.

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Overview

This PR fixes split-pane divider resizing by caching the adjacent panes' combined rendered size for the drag session and deriving current per-pane sizes from flex ratios so multiple drag events between renders accumulate correctly. It also adds focused unit coverage for the pure flex redistribution helper.

Concerns

No blocking correctness, security, or performance concerns found in the annotated diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

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

Powered by Oz

@oz-for-oss oz-for-oss Bot requested a review from vkodithala May 4, 2026 00:45
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.

Pane separator resizing horizontal divider moves very slowly

1 participant