Skip to content

feat(ui): scroll the diff pane with the horizontal wheel - #411

Merged
umputun merged 2 commits into
masterfrom
horizontal-wheel-scroll
Oct 25, 2026
Merged

umputun merged 2 commits into
masterfrom
horizontal-wheel-scroll

Conversation

@umputun

@umputun umputun commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Horizontal wheel and trackpad swipes over the diff pane now scroll it sideways, four columns per event like the arrow keys. They were swallowed before.

  • Burst handling. A scrollX change invalidates the whole render cache, so rendering per event would bring back the Cannot interrupt an active mouse scroll with an opposite scroll #179 stall on a fast swipe. The first event with no wheel tick in flight repaints at once, later events in the burst only mark a horizontal repaint as owed, and the existing wheel tick repaints once per interval. Vertical scrolling is unchanged, and a sideways repaint mid-burst never discharges a pending vertical cursor pin.
  • Leftover ticks. A key press, resize or blame load during a burst flushes pending work but cannot cancel the tick already scheduled. Ticks now carry an epoch that the flush bumps, and an older tick is dropped, so it cannot start a second tick chain beside the new one.
  • No effect in wrap mode, over the tree pane, or when the offset is already at its bound.

Large diffs can still scroll in visible steps because each horizontal repaint renders the whole file. Tests cover the leading-edge repaint, in-burst deferral, mixed vertical/horizontal bursts in both orders, flush paths and a tick left over from before a flush. README, site/docs.html and both plugin usage.md copies document it.

Fixed #334

horizontal wheel and trackpad swipes over the diff pane were swallowed. Each
scrollX change invalidates the whole render cache, so rendering per event would
bring back the #179 stall on a fast swipe. The first event with no wheel tick
in flight repaints at once, later events in the burst only set
wheelState.xPending, and the existing wheel tick repaints once per interval.
xPending is kept apart from renderPending so a mid-burst repaint never
discharges a vertical cursor pin.

Related to #334
a key press, resize or blame load during a wheel burst flushes pending work
and clears tickInFlight, but cannot cancel the tick already scheduled. With
horizontal wheel support that leftover tick could clear a newer tick's
ownership or repaint beside it, which could start a second tick chain and
trigger extra full renders during a sideways swipe. Ticks now carry an epoch that
flushWheelPending bumps, and handleWheelDebounce drops a tick from an older
epoch.

Related to #334
Copilot AI balanced review requested due to automatic review settings October 25, 2026 18:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@umputun
umputun merged commit 9ff3562 into master Oct 25, 2026
7 checks passed
@umputun
umputun deleted the horizontal-wheel-scroll branch October 25, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support horizontal scroll

2 participants