Repository navigation
fix(terminal): the wheel no longer moves a Codex selection menu's selection - #698
Conversation
|
Thank you, opticon454, for tracking this down and measuring it against a real Codex 0.164.0. This PR stops the wheel and touch scroll from walking the selection in Codex's own menus (the "Implement this plan?" prompt, the /model, /permissions and /review pickers, questions and approvals) by recognising the menu on screen and consuming the gesture instead of sending PageUp/PageDown. The fix is right and the test is good: I ran Three small things, which I will apply at merge time unless you would rather push them yourself:
One note for later, no change needed here: On #681: thanks for working out the conflict ahead of time. I agree with your ordering (this menu guard first), and whichever lands second gets that two-line resolution. I will merge this with the fixes above. |
|
Thanks @Ark0N. All three are pushed in
Typecheck, lint, prettier, the frontend syntax check and the related scroll, tile, touch and blocked-detection tests pass (286 in the files I ran). One thing to expect when both land: #699 edits the same long paragraph at |
|
Thank you, opticon454, for the quick turnaround. This PR stops the wheel and touch scroll from walking the selection in Codex's own menus by reading the menu off the screen and consuming the gesture instead of sending PageUp/PageDown. All three items from the first review are in Two one-line text edits I will make at merge time:
One follow-up for later, no change needed here: page keys wait on the 40 ms coalescing timer, so a PageUp queued from the composer just before the menu paints still reaches it (the existing I will merge this with those two edits, and #681 then gets the two-line resolution with your menu guard first, as you proposed. |
changeset: say Codex does not track the mouse "measured on 0.162.1 and 0.164.0", since 0.163.0 fullscreen was measured tracking it docs/architecture-invariants.md: list page-keys-dialog-open and page-keys-menu-open among the [scroll] decisions Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…odex selection menu's selection Conflicts resolved by keeping both sides: - src/web/public/terminal-ui.js (_maybePageCliTranscript): #698's Codex-menu consume check sits right after the open-dialog consume check (its sibling, as the docblock lists them), and #681's unloaded-scrollback fall-through (paneHistoryLines > 0) follows it. - docs/architecture-invariants.md: the hollow-pane paragraph carries #681's unloaded-scrollback sentence and #698's menu rewording. 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, thank you! This ships in 1.45.0 and closes #696. It met #681 and #699 in |
What
Scrolling the wheel over a Codex selection menu, such as the "Implement this plan?" prompt that follows a plan, no longer moves the menu's selection.
Fixes #696. Related: #699 (the mouse wheel needing 5 or more notches before a Codex pane scrolls at all, #697), which is independent of this one.
Overlap with #681
This conflicts with #681 (fix(terminal): load tmux history instead of paging Claude after a hollow tab switch) in one place, and the resolution is to keep both sides. Both PRs add a guard to
_maybePageCliTranscriptstraight after the existing open-dialog check:if (this._codexMenuOpen()) { ...return true; }(consume the wheel without paging while a Codex menu is showing);if ((this._paneHistoryLines?.get(this.activeSessionId) ?? 0) > 0) { ...return false; }(fall through to local scrolling when the pane still holds tmux history).git merge-treeof this branch with #681's head reports a single content conflict, insrc/web/public/terminal-ui.jsat that spot;terminal-tile.jsmerges automatically. The two guards are independent, and I would put this one first so a menu is never scrolled locally either. Whichever lands second will need that two-line rebase, and I will do it as soon as the other merges. pr-watch had also held this branch back for the same overlap.Other open PRs that share a file
pr-watch also lists #510, #608 and #686. They share
src/web/public/terminal-ui.jswith this branch (#686 alsoterminal-tile.js). Agit merge-treeof this branch with each head: #686 merges cleanly, and #510 and #608 report no conflict interminal-ui.jseither. The conflictsmerge-treedoes report for those two are in files this branch does not touch (session.ts,mux-interface.ts,keyboard-accessory.js), because #510 and #608 already conflict with current master on their own.Why
codex-cli 0.162.1 and 0.164.0 never turn on mouse tracking (tmux reports
alternate_on=1,mouse_any_flag=0in the composer, in plan mode and at the prompt;-c tui.alternate_screen="always",tui.fullscreen_transcript=trueandtui.mouse_scroll_speedchange nothing), so Codeman scrolls a Codex pane by turning the wheel into PageUp and PageDown. In the composer that pages the transcript. In Codex's selection menus the same keys move the selection, so each wheel notch walked the cursor through the options. Measured with a real browser against an isolated Codeman running Codex 0.164.0 at the "Implement this plan?" prompt:To the user the wheel (and PageUp/PageDown, which Codex itself binds to the selection there) looked dead, and the transcript behind the menu cannot be scrolled at all: Ctrl+T does nothing in that menu and Codex offers no other key. The 0.163.0 and 0.164.0 release notes do not mention it, so upgrading Codex does not fix it.
How
CodemanTerminalInput.isCodexSelectionMenu(terminal)reads the screen: a selected numbered option (› 1., indented two spaces in a question, or the notes field› Add notes) above a key-hint footer (enter select · esc back,enter continue · esc back,Press enter to confirm ...,tab to add notes ...). The footer must be the last thing on the screen, apart from wrapped hint rows, so an answer that quotes the hints above the composer is not a menu._maybePageCliTranscript(main pane) and its tile twin consume the wheel without sending a key while such a menu is showing, the same way they already do for a pending approval (tabAlertsaction). Once the menu closes the wheel pages the transcript again.workDetect.blockedLine(test/codex-blocked-detection.test.tspins that as deliberate), so nothing about blocked state, notifications orwaitchanges.Not changed
cliMouseTracking) still gets SGR wheel reports and is untouched.Tests
test/codex-menu-scroll.test.ts: the detector against the live capture fixtures intest/fixtures/codex-dialogs/(22 menus and dialogs read as menus; 10 idle, composer, working, slash-popup and quoted-dialog screens do not), the main pane sending no key at the "Implement this plan?" menu while paging from the composer, another CLI showing the same text still paging, and the tile asking the same question for its own terminal and session.tsc, the frontend syntax check and prettier pass.