Conversation
The piped-pager integration tests need a non-TTY stdin while keeping the PTY on stdout. Use bash `exec cmd < file` in the harness to swap fd 0 to a fixture file without introducing extra dependencies.
2642ddc to
8b97b6c
Compare
Greptile SummaryThis PR fixes mouse wheel scrolling in pager mode by introducing Confidence Score: 5/5Safe to merge; the only finding is a minor test-harness style issue with the login shell flag All production logic changes are correct and well-tested with both unit and PTY integration coverage. The single P2 finding is a cosmetic test-harness concern (unnecessary -l login flag) that does not affect correctness or CI reliability in practice. test/pty/harness.ts — minor: the -l login-shell flag in launchShellCommand is unnecessary Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[prepareStartupPlan] --> B{usesPipedPatchInput?}
B -- yes: kind=patch, file=- , stdin piped --> C[openControllingTerminal\nopen /dev/tty as ReadStream]
B -- no: file-backed or TTY stdin --> D[controllingTerminal = null]
C --> E[StartupPlan: app\ncontrollingTerminal set]
D --> E
E --> F[main.tsx\ncreateCLIRenderer]
F --> G[shouldUseMouseForApp\nstdinIsTTY default OR hasControllingTerminal]
G -- stdinIsTTY=true --> H[useMouse: true]
G -- hasControllingTerminal=true --> H
G -- both false --> I[useMouse: false]
H --> J[Mouse wheel scroll enabled\nin pager UI]
I --> K[No mouse support\nnon-interactive env]
Reviews (1): Last reviewed commit: "Launch piped PTY tests with bash exec st..." | Re-trigger Greptile |
|
Good catch — fixed in d2626fb. |
Problem
Mouse wheel scrolling was disabled in pager mode. The old code tied
useMousedirectly to!cliInput.options.pager, so any pager-style session (piped stdin, explicit--pagerflag) lost mouse support entirely.Fix
Decouple mouse support from pager chrome. A new
shouldUseMouseForApp()function enables mouse when an interactive terminal is available—either through a TTY stdin or a/dev/ttycontrolling terminal attachment. Pager mode now only controls UI chrome (hiding the menu bar), not input capabilities.Also simplifies
ControllingTerminalto only open/dev/ttyfor input, sinceprocess.stdoutalready carries the PTY output stream.Testing
shouldUseMouseForApp()covering all TTY/controlling-terminal combinations.hunk patch -(piped stdin)hunk pager(piped stdin)hunk patch <file> --pager(file-backed with explicit flag)Manual testing
Everything has pty tests but if you want to run through all of the different modes this covers by by hand:
Case 1: Piped patch -
Case 2: Piped pager
Case 3: File-backed --pager
Regression check: normal interactive mode (should work in both)