feat(tui): line-by-line scroll mode on modified mouse wheel#17669
Conversation
There was a problem hiding this comment.
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
createWheelKeyhelper in the Hermes Ink keypress parser. - Add a modifier-held wheel path in
useInputHandlersthat 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
useInputHandlersto 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.
3da5ed3 to
b040052
Compare
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.
b040052 to
83d0e2e
Compare
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
83d0e2e to
fc0f358
Compare
There was a problem hiding this comment.
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.
…-precision-mod feat(tui): line-by-line scroll mode on modified mouse wheel
…-precision-mod feat(tui): line-by-line scroll mode on modified mouse wheel
…-precision-mod feat(tui): line-by-line scroll mode on modified mouse wheel
…-precision-mod feat(tui): line-by-line scroll mode on modified mouse wheel
…-precision-mod feat(tui): line-by-line scroll mode on modified mouse wheel
Summary
Adds modifier-held precision scrolling for the TUI transcript.
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.tsnpm run type-checknpx eslint src/app/useInputHandlers.ts src/lib/wheelAccel.ts src/__tests__/wheelAccel.test.ts