Skip to content

fix(ui): smooth mouse-wheel review scrolling#208

Merged
benvinegar merged 1 commit intomainfrom
fix/mouse-wheel-scroll-acceleration
Apr 18, 2026
Merged

fix(ui): smooth mouse-wheel review scrolling#208
benvinegar merged 1 commit intomainfrom
fix/mouse-wheel-scroll-acceleration

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • replace the fixed multi-row mouse wheel jump with cadence-based OpenTUI acceleration
  • keep single wheel ticks precise on small diffs while allowing sustained wheel gestures to speed up
  • document the scrolling improvement in CHANGELOG.md

Testing

  • bun run typecheck
  • bun test src/ui/AppHost.interactions.test.tsx -t "mouse wheel scrolling updates the active file and hunk to the viewport center|shift plus mouse wheel scrolls code horizontally|shift plus mouse wheel does not move the vertical review position"
  • bun test test/pty/ui-integration.test.ts -t "mouse wheel scrolling moves the review pane|the first mouse-wheel step still advances content under the always-pinned file header above a collapsed gap|one mouse-wheel step down then up restores the collapsed-gap view beneath the pinned file header"

This PR description was generated by Pi using OpenAI o3

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 18, 2026

Greptile Summary

Replaces the previous fixed multi-row mouse-wheel jump with an OpenTUI MacOSScrollAccel-based approach that keeps single ticks precise while allowing sustained gestures to ramp up to 3× speed. The instance is correctly stabilized with useMemo([]) and the existing keyboard scrollStep=1 and shift+wheel horizontal scroll paths are unaffected.

Confidence Score: 5/5

Safe to merge — minimal, well-scoped change with no correctness issues

All three changed files are clean: the new factory is a single-responsibility wrapper, DiffPane correctly gates the instance behind useMemo, and the CHANGELOG entry lands in the right section. No P0/P1 findings.

No files require special attention

Important Files Changed

Filename Overview
src/ui/lib/scrollAcceleration.ts New file encapsulating MacOSScrollAccel instance creation with A=0.4, tau=4, maxMultiplier=3 — clean, single-responsibility factory function
src/ui/components/panes/DiffPane.tsx Adds scrollAcceleration prop to the scrollbox via a useMemo-stabilized instance; keyboard step size (scrollStep=1) is unchanged and the existing shift+wheel horizontal scroll logic is unaffected
CHANGELOG.md Entry correctly added to the [Unreleased] Fixed section

Sequence Diagram

sequenceDiagram
    participant User as User (wheel gesture)
    participant OT as OpenTUI ScrollBox
    participant MA as MacOSScrollAccel
    participant VP as DiffPane Viewport

    User->>OT: mouse wheel tick
    OT->>MA: computeMultiplier(timeSinceLastTick)
    MA-->>OT: multiplier (1.0 → up to 3.0)
    OT->>VP: scrollBy(delta × multiplier)
    VP-->>User: updated view

    Note over MA: A=0.4, tau=4, maxMultiplier=3<br/>First tick ≈ 1×, sustained burst → 3×

    User->>OT: shift + mouse wheel tick
    OT->>OT: onMouseScroll fires first
    OT->>VP: onScrollCodeHorizontally(±1)
    OT->>OT: queueMicrotask restores scrollTop/Left
Loading

Reviews (1): Last reviewed commit: "fix(ui): smooth mouse-wheel review scrol..." | Re-trigger Greptile

@benvinegar benvinegar merged commit 63a1c32 into main Apr 18, 2026
4 checks passed
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.

1 participant