Repository navigation
fix(terminal): herdr-core default pictures draw from the first output; switch follows the terminal - #3195
Conversation
…ut, and show the switch from the terminal Output that may hold a picture waits (bounded) for the image addon when pictures are wanted, and the Settings switch follows the terminal connection's terminal-history instead of the health read. Fixes #3184.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 35 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…, catch a split introducer
…o frame for a bare ESC
|
Review notes at cc9ebe4 (omo CLEAR; final Codex check found no HIGH). Left as is, with no follow-up issue because neither was reproduced:
|
|
CodeRabbit did not review this PR: its review limit was reached. The omo review (CLEAR at cc9ebe4) and three Codex passes stand in; their findings and how each was resolved are in the PR body and the comment above. |
|
Merge note (merge pass) at head cc9ebe4:
|
Fixes #3184. Also covers the CodeRabbit note on #3171 (
src/components/SettingsDialog.tsx, Pictures switch).Problem
With no Pictures choice stored on the device, herdr-core turns pictures on by default (
settings.terminalImages ?? terminalHistory).terminalHistoryis React state set once the server liststerminal-history, and the image addon is a lazy chunk imported from an effect after that. The attach replay arrives in the meantime, so xterm parsed a sixel/iTerm2 picture in a pane's first output before the addon existed and dropped it.Settings showed the switch from the health read (
shownHerdr.runtime === "herdr-core"). When that read fails, or names herdr while the terminal connection liststerminal-history, the switch showed off while the terminal drew pictures.Fix
src/lib/terminalImages.ts:holdForPictures(terminal, data, resume). When pictures are wanted and the addon is not on yet, output that may hold a picture waits untiluseTerminalImagesturns pictures on or off for that terminal. That covers a DCS, an OSC 1337, or a frame ending in a split OSC 1337 introducer (ESC ],ESC ]1,ESC ]13,ESC ]133). The import failing, the effect cleaning up, or 1 s passing releases it. While output is held, every queued frame, and every frame that arrives meanwhile, is acknowledged (pty-ack) at once, as xterm's own write buffer would take it. The server's output-stall stop (OUTPUT_STALL_MS, 2 s) therefore never sees the wait. After a timeout that terminal never waits again, so a stalled chunk fetch cannot stop a pane's output.src/lib/useTerminalMount.ts: the output queue calls it before each write. "Wanted" is computed synchronously as the stored choice, elsesocket.hasTerminalHistory(), so there is no state-to-effect gap. A pane switch while output is held still drops the queued frames as before. The OSC 52 replay guard reads the parser state, because nothing is parsing while output is held.src/App.tsx: when no choice is stored, the switch shows on whenever the terminal connection hasterminal-history(the same fact PaneTerminal uses). It falls back to the health read only until the connection has listed its features.Output from herdr, output with no picture sequence, and terminals with pictures turned off are never held.
Tests
scripts/terminal-images-demo-regression.tsgets two new cases with nothing stored on the device:terminal-historylisted): a picture in the attach's first replayed output is drawn, a later one is drawn, and the switch shows on even though the demo's health names herdr.Failing first on main c46dd12: the first-output picture assertion failed (pixel null). With only the App change reverted, the switch assertion failed.
Validation
bun run check fast: pass (12797 unit tests, typecheck, build).herdr-ci-runner:local: terminal-images, terminal-ghostty, core-history-scroll, replay-clipboard, terminal-view-replay, terminal-early-keys, terminal-release-no-watch, terminal-paste-insert, terminal-autoswitch and terminal-keyboard demo regressions all PASS. After the review round, check fast and the first five were re-run, and they still pass.No new controls. The composer UI is unchanged.
Review rounds
terminal-historywas already set.ESC ]1337introducers are held, andhasTerminalHistory()wins.