Skip to content

fix(terminal): prevent bursts of TUI mouse wheel reports - #1500

Open
mydd7 wants to merge 1 commit into
crynta:mainfrom
mydd7:fix/tui-wheel-report-bursts
Open

mydd7 wants to merge 1 commit into
crynta:mainfrom
mydd7:fix/tui-wheel-report-bursts

Conversation

@mydd7

@mydd7 mydd7 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

A fast or inertial wheel event can send ten mouse notches to an application. Each notch can scroll several rows in the TUI, which multiplies the movement.

Limit mouse tracking to one notch per event. Small trackpad deltas still accumulate, and whole excess notches are discarded. Normal scrollback, scroll speed scaling and DEC 1007 cursor key scrolling retain their existing behavior.

Four regression cases fail on main and pass with the fix. The full frontend suite, lint, production build, startup graph and size budgets passed. Native macOS trackpad behavior still needs a manual check.

Refs #1498 and #1364.

Summary by CodeRabbit

  • Bug Fixes
    • Fast scrolling now sends one wheel step per event, regardless of scroll distance, and excess movement is no longer queued.
    • Scroll input accumulates more consistently at both slower and faster speeds.
    • In alternate-scroll mode, large scrolls send up to ten cursor-key steps per event.

@mydd7
mydd7 requested a review from crynta as a code owner November 17, 2026 05:48
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Wheel input now uses a one-report-per-event limit for mouse reporting and a separate ten-key limit for alternate scrolling. TerminalMouse.wheel sends a single report when the pointer position is valid.

Changes: Terminal wheel input

Layer / File(s) Summary
Route-specific wheel limits and report emission
src/modules/terminal/ghostty/input/terminalWheel.ts, src/modules/terminal/ghostty/input/GhosttyInputController.ts, src/modules/terminal/ghostty/input/TerminalMouse.ts, src/modules/terminal/ghostty/input/GhosttyInputController.test.ts
The controller limits mouse-report routes to one report per event and retains a ten-key limit for alternate scrolling. TerminalMouse.wheel sends one report for a valid pointer position. Tests cover delta accumulation, discarded excess motion, and alternate-scroll bursts.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • Issue 1498 reports excessive terminal scroll speed on macOS, which overlaps with this change’s wheel-report limit.
  • Issue 1364 reports high terminal scroll speed in Claude Code on macOS, which overlaps with this change’s wheel-report limit.

Possibly related PRs

  • crynta/terax-ai#1408: Changes mouse-report wheel input and trackpad delta accumulation in the same controller path.
Merge Risk: Minimal · up to b0c89

Mouse wheel reports in terminal apps are now limited to one per event, and the change is small and easy to revert. Native trackpad behavior still needs manual verification, but no merge-blocking risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(terminal): prevent bursts of TUI mouse wheel reports" follows Conventional Commits (type fix, scope terminal). It matches the main change: the wheel handling now sends one wheel report …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(terminal): prevent bursts of TUI mouse wheel reports" follows Conventional Commits (type fix, scope terminal). It matches the main change: the wheel handling now sends one wheel report per fast event and drops excess whole notches, which stops bursts of TUI mouse wheel reports. The title is descriptive and fits the changeset and PR objectives.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b217c43 and b0c8910.

Files selected for processing: 4

  • src/modules/terminal/ghostty/input/GhosttyInputController.test.ts
  • src/modules/terminal/ghostty/input/GhosttyInputController.ts
  • src/modules/terminal/ghostty/input/TerminalMouse.ts
  • src/modules/terminal/ghostty/input/terminalWheel.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

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