Repository navigation
fix(terminal): a mouse wheel notch pages the CLI's transcript at once - #699
Conversation
|
Thank you @opticon454 for this, and for the clear write-up in #697. This makes the first mouse-wheel notch over a page-key pane (Codex without mouse tracking, opencode) page the transcript at once, while a 3 s notch debt keeps slow notches from each paging a full screen. The logic checks out: your new and rewritten tests fail on master and pass here, and typecheck, lint, format, the frontend syntax check and the four Chromium wheel/touch suites are all green. A few things to land with it:
I will apply these on top when merging. If you push them first, I will merge your version instead. |
|
Thanks @Ark0N. All four are pushed in
Typecheck, lint, prettier, the frontend syntax check, the scroll-routing, tile and touch unit tests (200) and the four Chromium wheel and touch suites (9) pass. Heads-up: this and #698 both edit the long gesture-rules paragraph at |
|
Thank you @opticon454 for this, and for turning the first round around so quickly. This makes the first mouse-wheel notch over a page-key pane (Codex without mouse tracking, opencode) page the transcript at once, with a 3 s notch debt so slow notches still repay that page instead of each paging a screen. All four points from the first review are in At merge time I will touch two comment fragments in Thanks also for flagging the overlap with #698 on |
pageKeysForGesture comment (terminal-ui.js:218): the gap stretches to PAGE_KEY_NOTCH_DEBT_MS after a notch-sized opener, not only PAGE_KEY_DEBT_MS pageKeysForGesture comment (terminal-ui.js:286): a repaid debt ends either lifetime, not only the one-second one Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
terminal-ui.js: the _maybePageCliTranscript JSDoc names PAGE_KEY_NOTCH_DEBT_MS as the stretched gap after a notch-sized opener terminal-scroll-routing.test.ts: the notch-opener test comment uses the real numbers (36 rows, 14 rows owed) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… CLI's transcript at once Conflict in docs/architecture-invariants.md resolved by keeping both sides: the hollow-pane paragraph carries #681's unloaded-scrollback sentence, #698's Codex-menu rewording and #699's notch rewording (a word-level three-way merge; the three edits touch disjoint sentences). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Merged, thanks! This ships in 1.45.0 and closes #697. The hollow-pane paragraph in architecture-invariants had edits from #681, #698 and this PR, and it merged word for word with no conflicts. At merge I only touched comments: |
What
A mouse wheel over a Codex pane (and any CLI paged with PageUp and PageDown) now moves the transcript on its first notch, instead of after 5 notches in Chrome or 7 on Firefox's 3-line notches.
Fixes #697. Related: #698 (the wheel moving a Codex menu's selection, #696), which is independent of this one.
Why
When a CLI does not track the mouse (codex-cli 0.162.1 and 0.164.0 do not),
_maybePageCliTranscriptturns the wheel into whole-page keys.pageKeysForGestureonly pages after half a screen of travel, except for a trackpad-sized opening event (under 2 rows), which pre-pays its page and owes the travel back. A mouse notch is 3 to 4 rows, so it only accumulated and the pane showed nothing. Measured from rest in Chromium against Codeman and Codex 0.164.0, 38 rows, 100 px notches 450 ms apart:A short scroll of one to four notches looked like a dead wheel, while PageUp and PageDown from the keyboard responded at once.
The trade-off this changes
The comment on
PAGE_KEY_IMMEDIATE_MAX_ROWSgave the reason notches were left to accumulate: paging at once on a notch made slow notches, each its own gesture past the gap, page a full screen apiece. That is still guarded against:perPagerows of travel, the same count as before, with the first page arriving sooner (a review on this PR found the first cut dropped that leftover and sent 40 pages for 200 notches against 42 on master).PAGE_KEY_NOTCH_DEBT_MS(3 s, against the trackpad'sPAGE_KEY_DEBT_MSof 1 s), so notches 1.2 s apart still repay one page instead of paging a screen each. Notches more than 3 s apart are separate gestures and each pages, which is the most that can be said for a pager that can only move a screen at a time.test/terminal-scroll-routing.test.ts's existing case, five notches at 40, 250 and 1200 ms spacing sending exactly one page, still passes unchanged. The trackpad rules, the debt lifetime of 1 s, reversals and pinches are untouched.How
pageKeysForGesture(terminal-ui.js, shared by the main pane and tiles) pre-pays an opening event of any size below one page (counting the leftover travel of the gesture before), tags the debt of an opener of 2 rows or more (notch: true) and gives itPAGE_KEY_NOTCH_DEBT_MS. The signal is the opener's size, not the device, so a touch contact whose first touchmove is 2 rows or more, or a brisk trackpad flick that opens large, is treated the same way. Nothing else changes.Overlap with open PRs
This PR changes
pageKeysForGestureand its comments insrc/web/public/terminal-ui.js, which other open PRs also edit elsewhere in the file. pr-watch lists #510, #608 and #686 as sharing a file. Agit merge-treeof this branch with each head shows no conflict interminal-ui.jsfor any of them. The conflictsmerge-treedoes report for #510 and #608 are in files this branch does not touch (session.ts,mux-interface.ts,keyboard-accessory.js), because those two PRs already conflict with current master on their own. It also merges cleanly with #681 (the scroll-after-tab-switch PR that conflicts with the sibling #698) and with #698 itself. I did not try the others, and will rebase as they land.Tests
preserves accumulated coarse Codex wheel fallback travel(renamed) interminal-scroll-routing.test.ts, and the two tile cases interminal-tile-scroll.test.ts.[UP, '', UP, UP, UP, UP](the leftover is carried; it fails without that), and a touch contact opening with 3 rows pages once and repays.terminal-scroll-routing.test.ts: Chrome and Firefox notch sequences (a page on notch 1, repaid, the next gesture opening on the next notch), a debt kept across 1.2 s pauses and dropped after more thanPAGE_KEY_NOTCH_DEBT_MS, and a reversal paging back.codex-wheel-routing,terminal-touch-paging,terminal-tile-scroll.browser,terminal-touch-swipe-axis) pass; lint,tsc, the frontend syntax check and prettier pass.