Skip to content

feat(tui): line-by-line scroll mode on modified mouse wheel#17669

Merged
OutThisLife merged 2 commits into
mainfrom
bb/tui-scroll-precision-mod
Apr 30, 2026
Merged

feat(tui): line-by-line scroll mode on modified mouse wheel#17669
OutThisLife merged 2 commits into
mainfrom
bb/tui-scroll-precision-mod

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds modifier-held precision scrolling for the TUI transcript.

  • Option/Alt or Ctrl + mouse wheel scrolls at most one row per short interval, so smooth mice and trackpads do not move multiple rows for one intended line step.
  • Plain mouse wheel keeps the existing accelerated scrolling behavior.
  • Releasing the modifier keeps precision active until the current wheel burst idles, so queued/momentum wheel events do not switch into acceleration mid-stream.

Notes

Cmd + wheel is not available to the TUI in common macOS terminals because the terminal handles it before forwarding mouse events. Option/Alt is the portable modifier carried by SGR/X10 mouse events.

Test plan

  • npm test -- --run wheelAccel.test.ts parse-keypress.test.ts
  • npm run type-check
  • npx eslint src/app/useInputHandlers.ts src/lib/wheelAccel.ts src/__tests__/wheelAccel.test.ts

@alt-glitch alt-glitch added type/feature New feature or request comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have labels Apr 30, 2026
@OutThisLife OutThisLife requested a review from Copilot April 30, 2026 00:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a modifier-gated “precision” wheel scroll mode in the TUI by preserving mouse-wheel modifier bits (SGR + X10) through input parsing and using a separate scroll-step state machine when Alt/Option (meta) or Ctrl is held.

Changes:

  • Forward Shift/Meta/Ctrl modifier bits for SGR/X10 mouse wheel events via a new createWheelKey helper in the Hermes Ink keypress parser.
  • Add a modifier-held wheel path in useInputHandlers that bypasses the existing acceleration logic.
  • Extend unit tests for wheel modifier decoding and add tests for the new precision step state machine.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui-tui/src/lib/wheelAccel.ts Introduces a new “precision” wheel step state machine and env-tunable parameters.
ui-tui/src/app/useInputHandlers.ts Switches wheel handling to use precision mode when meta/ctrl is held; resets state on modifier transitions.
ui-tui/src/tests/wheelAccel.test.ts Adds unit tests for precisionWheelStep.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Preserves modifier bits for wheel events (SGR and X10) using createWheelKey.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds test coverage for wheel modifier decoding in both SGR and X10 paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/app/useInputHandlers.ts Outdated
Comment thread ui-tui/src/lib/wheelAccel.ts Outdated
Comment thread ui-tui/src/__tests__/wheelAccel.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a modifier-gated “precision” mouse-wheel scrolling mode for the TUI transcript, allowing line-by-line scrolling behavior while keeping the existing accelerated scrolling for unmodified wheel input.

Changes:

  • Introduces a new precision wheel state machine (precisionWheelStep) with configurable burst coalescing via env vars.
  • Updates input handling to route wheel events to precision vs accelerated scrolling based on meta/ctrl, resetting state when crossing the modifier boundary.
  • Enhances wheel parsing to preserve wheel modifier bits (SGR + legacy X10) and adds targeted test coverage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui-tui/src/lib/wheelAccel.ts Adds precision scroll state + env-configurable burst behavior alongside existing accel logic.
ui-tui/src/app/useInputHandlers.ts Routes wheel events into precision vs accel paths based on modifier keys and resets state on mode switches.
ui-tui/src/tests/wheelAccel.test.ts Adds unit tests covering precision scroll semantics (gesture edges, bursts, direction flips).
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Decodes ctrl/meta/shift modifier bits for wheel events (SGR and X10) instead of dropping them.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds tests validating wheel modifier decoding for both SGR and X10 formats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/lib/wheelAccel.ts Outdated
Comment thread ui-tui/src/lib/wheelAccel.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a modifier-gated “precision” scroll mode for the TUI transcript, enabling line-by-line wheel scrolling when Alt/Option (meta) or Ctrl is held, while preserving existing accelerated scrolling for plain wheel input.

Changes:

  • Implemented a dedicated precision wheel state machine (leading-edge + fractional burst coalescing) alongside the existing acceleration logic.
  • Routed wheel handling in useInputHandlers to choose precision vs accelerated behavior based on wheel modifier flags, with state resets on mode transitions.
  • Updated mouse wheel parsing to propagate ctrl/meta/shift modifier bits for SGR and legacy X10 wheel events, plus added/expanded tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui-tui/src/lib/wheelAccel.ts Adds precision wheel state + env-configurable burst parameters and step calculation.
ui-tui/src/app/useInputHandlers.ts Switches between precision and accelerated scroll paths based on modifier-held wheel.
ui-tui/src/tests/wheelAccel.test.ts Adds unit tests covering precisionWheelStep semantics.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Decodes modifier bits for wheel events via a dedicated createWheelKey helper.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds tests verifying modifier decoding for SGR and X10 wheel encodings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/lib/wheelAccel.ts Outdated
Comment thread ui-tui/src/__tests__/wheelAccel.test.ts Outdated
Decode Shift, Meta, and Ctrl bits from SGR and legacy X10 wheel event button bytes so TUI input handlers can distinguish modified wheel gestures from plain scrolling.
@OutThisLife OutThisLife force-pushed the bb/tui-scroll-precision-mod branch from b040052 to 83d0e2e Compare April 30, 2026 01:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a “precision” line-by-line transcript scroll mode when a modifier is held during mouse-wheel input, while preserving the existing accelerated scroll behavior for unmodified wheel events. This is implemented by forwarding wheel-event modifier bits out of the input parser and gating the transcript wheel handler on those modifiers with a short “sticky” window.

Changes:

  • Add modifier-gated precision scrolling (coalesced to at most 1 row per short interval) in the TUI transcript wheel handler, including a burst-sticky behavior after modifier release.
  • Decode and forward Ctrl/Meta/Shift modifier bits for SGR/X10 wheel events in parse-keypress.
  • Add unit tests validating modifier decoding for SGR and legacy X10 wheel encodings.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
ui-tui/src/app/useInputHandlers.ts Implements modifier-held (and sticky) precision wheel scrolling for the transcript and keeps unmodified wheel on accelerated path.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Preserves wheel detection while forwarding modifier bits via a dedicated createWheelKey helper.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds coverage for wheel modifier decoding across SGR and X10 encodings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/app/useInputHandlers.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a “precision” transcript scrolling mode when a modifier is held during mouse-wheel input, aimed at making smooth wheel/trackpad bursts advance at most a line-step per short interval instead of accelerating.

Changes:

  • Add modifier-held precision wheel scrolling (with burst-sticky behavior) in the TUI transcript input handler.
  • Preserve Ctrl/Meta/Shift modifier bits when parsing SGR/X10 mouse wheel events in hermes-ink.
  • Add unit tests to validate wheel modifier decoding for both SGR and legacy X10 mouse encodings.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
ui-tui/src/app/useInputHandlers.ts Adds precision/sticky wheel handling path when Ctrl/Alt(=meta) is held.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Decodes and preserves modifier bits on wheel events via createWheelKey.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds coverage for modifier decoding on wheel events (SGR + X10).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/app/useInputHandlers.ts Outdated
Comment thread ui-tui/src/app/useInputHandlers.ts Outdated
Route Option/Alt or Ctrl wheel input through a gated precision path that scrolls at most one row per short interval, while preserving the existing accelerated behavior for plain wheel input. Keep precision active briefly after modifier release so queued wheel events from the same gesture do not jump into acceleration mid-stream.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a “precision” (line-by-line) transcript scroll mode in the TUI when the mouse wheel is used with modifiers, while preserving the existing accelerated scrolling behavior for unmodified wheel input. It also updates hermes-ink wheel parsing so wheel events retain modifier bits (Ctrl/Alt/Shift) for downstream bindings.

Changes:

  • Add a modifier-held precision wheel path (Ctrl or Alt/Option) in the TUI input handler, including a short sticky window to keep precision active through a wheel burst.
  • Update hermes-ink’s SGR/X10 wheel parsing to preserve modifier bits by emitting wheel keys with decoded ctrl/meta/shift.
  • Add tests verifying modifier decoding for both SGR and legacy X10 wheel sequences.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
ui-tui/src/app/useInputHandlers.ts Adds precision wheel scrolling gated by Ctrl/Alt/Option with min-gap throttling and sticky burst behavior.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.ts Ensures wheel events preserve modifier bits via a dedicated createWheelKey helper.
ui-tui/packages/hermes-ink/src/ink/parse-keypress.test.ts Adds coverage for wheel modifier decoding across SGR and X10 encodings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@OutThisLife OutThisLife merged commit 8cce85b into main Apr 30, 2026
13 of 14 checks passed
@OutThisLife OutThisLife deleted the bb/tui-scroll-precision-mod branch April 30, 2026 01:56
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…-precision-mod

feat(tui): line-by-line scroll mode on modified mouse wheel
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…-precision-mod

feat(tui): line-by-line scroll mode on modified mouse wheel
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…-precision-mod

feat(tui): line-by-line scroll mode on modified mouse wheel
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…-precision-mod

feat(tui): line-by-line scroll mode on modified mouse wheel
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…-precision-mod

feat(tui): line-by-line scroll mode on modified mouse wheel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants