Repository navigation
fix(terminal): fold a mirrored pane wider than a phone to the screen - #1961
Conversation
A Windows PC's herdr has no terminal attach, so the bridge mirrors a pane at its own size on that PC (pane-geometry fixed: true) and a phone drew that grid 1:1: every row ran off the right edge. The grid now stays as it is, unseen, for its input and readers, and lib/terminalFold.ts draws its rows again as coloured text that wraps at the screen's width, as Collie draws a pane read. The pane menu's Original width (terminalMirrorWrap, this device's) draws the grid as it is again. Observers, attached ptys and a mirror the mount fits are unchanged.
…grid's Review follow-up. The folded rows now keep the grid cursor's row in view instead of their bottom, so a cleared shell's prompt on the first row stays in sight, and the hidden grid moves down under them until its cursor row lies on theirs, so an IME preedit shows where its text will. A tap on a web address or a file path opens it as the grid's links do, a font change folds or unfolds at once, a split half made active folds again, and a wheel past the folded rows scrolls history at the chosen speed. A watching phone folds too. Until the pane menu says otherwise, a narrow screen folds and a desktop keeps the original width.
Second review round. The hidden grid now moves down by `top` rather than a transform: a transform made it a stacking context, and an IME preedit drawn by xterm's helpers went under the folded rows. A tap on the right half of a link's last character opens it, and a web address keeps a closing parenthesis it opened. The browser regression composes a Korean word and checks the preedit is the topmost thing where it is drawn; with the transform it fails.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Display preference and pane controls src/lib/settings.ts, src/lib/settings.legacy-fixture.ts, src/App.tsx, src/components/PaneCanvas.tsx, src/components/PaneTerminal.tsx, src/lib/i18n/terminal.*.ts |
Adds the device-specific terminalMirrorWrap setting and uses it, or the screen-width default, to select the mirrored pane display mode. The pane menu toggles between “Wrap to screen” and “Original width.” |
Folded terminal rendering src/lib/terminalFold.ts, src/components/PaneTerminal.css, src/lib/terminalFold.test.ts |
Adds wrapped-row rendering with terminal styling, link and cell hit testing, cursor-row alignment, and fold lifecycle handling. Styles the overlay and tests color, text, URL, and column rendering. |
Terminal interactions and fold lifecycle src/lib/useTerminalMount.ts, src/lib/terminalWheel.ts, src/lib/useTerminalRefits.ts |
Connects folding to mirror state, cursor following, link handling, focus, panning, wheel input, geometry changes, and cleanup. Forwarded trusted wheel events follow the real-event path for history scrolling and mouse reporting. |
Browser regression and supporting documentation scripts/mirror-fold-demo-regression.ts, scripts/ci-browser.sh, DESIGN.md, changelog.d/mirror-fold-phone.md, docs/development.md |
Adds browser checks for phone and desktop layouts, menu persistence, links, history scrolling, focus, IME preedit, and attached panes. Adds the regression to browser CI and documents the behavior and command. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Possibly related issues
- devswha/herdr-web-ui#871: Describes a Windows mirrored fixed-grid pane being cut off on phones; this PR folds oversized mirrors to screen width.
Possibly related PRs
- devswha/ovis#1800: Both changes address terminal input and IME preedit behavior on narrow layouts; this PR synchronizes the input viewport while rendering folded mirrors.
Merge Risk: 
Minimal · up to 47b60
-
The display choice updates the folded terminal as intended. No identified issue prevents merging after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Check name Status Explanation Title check The title "fix(terminal): fold a mirrored pane wider than a phone to the screen" names the main change. The changeset adds folding of mirrored terminal grids wider than the mount (src/lib/terminalFold… Description check The description follows the repository template. It has a Change section that describes the problem, the fix, and the resulting behavior, and it links the related herdr issue (herdrdev/herdr#4821). It… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title "fix(terminal): fold a mirrored pane wider than a phone to the screen" names the main change. The changeset adds folding of mirrored terminal grids wider than the mount (src/lib/terminalFold.ts, useTerminalMount.ts, PaneCanvas, PaneTerminal) so they wrap to the screen width on phones. It is concise, specific, and follows a conventional commit style. The title omits the per-device Original width/Wrap to screen setting, which is secondary.
Full details: Description check
-
Explanation
The description follows the repository template. It has a Change section that describes the problem, the fix, and the resulting behavior, and it links the related herdr issue (herdrdev/herdr#4821). It has a Validation section that lists the new regression script, unit tests, the full check run, and real-device results. The template asks for a maintainer-agreed issue link for features, and this is a fix, so no issue link is required. The description is thorough and includes known limits, so it passes.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 15 files. (5 skipped: 5 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Comment @coderabbitai help to get the list of available commands.
|
Merge pass review of 47b60e4: changes requested.
What holds, per the code reviewer and my own QA:
MAJOR (Codex):
MINOR (Codex): bold brightening happens before inversion ( MEDIUM (code reviewer): the LOW (code reviewer, optional):
The re-review will cover only the new commits. |
… links as the grid's Merge pass follow-up. Wrap to screen / Original width now has a key of its own (ovis:mirror-wrap), so an older tab's whole-record save no longer erases it. A default foreground on a background of the program's own colour now gets the minimum contrast, and the contrast search tries the other direction when the first cannot reach it. Inverse swaps the colours before bold brightens the foreground, as xterm draws them. A tap on a labelled OSC 8 hyperlink opens its target through the grid's own link policy. The browser regression adds an OSC 8 label and an attached pane wider than the phone, watched, which must not fold.
|
Thanks for the review. Every point is addressed in 00e4378; each one has a check that fails without its fix. MAJOR (Codex)
MINOR (Codex): inverse now swaps first and bold brightens the resulting foreground, as xterm does. Unit test: MEDIUM (code reviewer): new case LOW
Verification on 00e4378: |
|
Merge pass re-review of 00e4378 (Codex Sol, gpt-6.1-sol, xhigh): one item left. Fixed, re-checked against the earlier reproductions:
MEDIUM, still open: a URL-shaped OSC 8 label skips the grid lookup (
Only this change will be re-reviewed. |
…ts label shows Merge pass re-review. A tap on the folded rows now resolves the cell's own target (an OSC 8 hyperlink, then a file path) before an address its text shows, as the grid ranks its links: a hyperlink labelled with another URL opened the label's address. The browser regression taps such a label.
|
Fixed in d0dbc7d. A tap on the folded rows now resolves the cell's own target first: its OSC 8 hyperlink, then a file path. Only when the cell has neither does it fall back to an address its text shows, which matches how the grid ranks its links ( The browser regression now taps an OSC 8 link labelled
|
|
The code review is done: Codex approved d0dbc7d, and the code reviewer passed the PR earlier. CI is red on the PR's own new script, though, so it can't merge yet.
I suspect the click lands one cell off because the runner has different font metrics. A tap on the right half of the last glyph then falls outside the link that |
…opened The fold regression failed on the GitHub runner: the first link tap opened no tab. It tapped fixed page coordinates measured a moment before, and the folded rows can move in between (a resize settling, the rows following the cursor). Each tap is now measured against the row that holds the text and Playwright clicks that row once it holds still. When no tab opens, the script reports what the tap reached and which links the page tried to open.
|
I looked into the red
|
|
CI is green on 9ca1f71 (run 40275951384). |
|
Merge pass review report. Overall: PASSED. This is an ordinary client change. Reviewers: Codex Sol (gpt-6.1-sol, xhigh), omo-native-code-reviewer (claude-opus-5-5) and my own QA. Review history:
What holds:
Findings and how each was resolved:
Tests:
CI fix 9ca1f71 (test only):
Left as follow-ups (LOW):
This PR shares files only with outside PRs #1639 and #1911, which already conflict with main, and with #1952 on |
Merge upstream/main (352 commits up to devswha#1961) into next
…1963) ## Problem #1961 folds a mirrored pane (a Windows PC) that is wider than a phone. An attached pane (a Linux or macOS PC) gets cut off in the same way whenever the phone is not the one sizing the pty: - **A device paired to watch** draws the pty's grid, and a desktop sized that grid. In QA a desktop held the pane at 174x53. On a 390 px phone every row ran off the right edge, with 1365 px to pan sideways. - **A driving phone with its soft keyboard up** keeps the grid it shows until the keyboard goes (#1045). If a desktop takes the pty in the meantime, the phone draws the desktop's grid. The same happens when the terminal lens comes back from Chat with the keyboard still up. When the phone drives the pty, the program redraws at the phone's width, so there is nothing to fold. The Collie comparison (lane collie-research, section 8 item 1) recommended this reading view for these cases. ## Fix The change is client only. `server/`, `shared/`, herdr and the way devices share a pane's size are unchanged. - `lib/terminalFold.ts`: whether to fold is now decided by `foreign()` (this browser does not size the grid) and `wrap()` (the user's choice). The fold also reports when a foreign grid is wider than its mount. - `lib/useTerminalMount.ts`: a grid counts as foreign when it is a mirror, a watched grid, or a grid held under the keyboard. A split's following half never counts. The folded rows come from the xterm buffer the attach stream wrote: there is no `pane.read`, scrollback stays 0, and nothing resizes, takes over or refocuses the pane. Cursor, IME and hidden-input handling is #1961's: the hidden grid still moves under the folded cursor row. - **Pane menu**: a small `wideGrids` store, fed by the fold, lets the tab's ⋯ sheet offer **Original width** / **Wrap to screen** for such panes, as it already did for mirrors. It uses the same device setting (`terminalMirrorWrap`, key `ovis:mirror-wrap`), which is not renamed, so choices already saved still apply. A driving phone's menu does not show the item. - **Under the keyboard** the grid is not adopted, so its mount had `overflow: hidden`. Every fold now scrolls up and down, and a finger pans the folded rows before it scrolls the pane at their edges. - **Pane switch**: switching panes decides the fold again, so the menu stops offering the width choice for the pane left behind. - **Taps**: a tap on folded rows opens a link or focuses the terminal, as on a mirror. It does not send a mouse click to the program. herdr's attach turns on mouse reporting for every pane (`?1000h ?1002h ?1003h ?1006h`, seen on a plain bash pane and on btop), so the client cannot tell which program wants clicks. Original width still passes clicks through. DESIGN.md says so. **Design precedent:** the same as #1961. The apps this repo compares against size their terminal to the window, which a watching device cannot do. This follows Collie (AltanS/collie, `ansi-output.tsx`), which never resizes a pane. No code was copied. DESIGN.md extends #1961's entry. ## Validation `scripts/mirror-fold-demo-regression.ts` (browser lane) now covers an attached pane whose pty grid (120x40) is wider than the phone. The fixture replays herdr's mouse modes, as a real attach does. - **Driving:** the grid is the phone's own and fitted, nothing is folded, and the menu has no Original width. - **Watching:** folded whole at 390, 412, 915x412 and 844x390. The folded rows are the stream's rows in order, and the Korean words fold whole. - **Toggle:** the menu offers Original width. Original width shows a btop-like box at full width, and **real swipes** pan it to its right edge. Wrap to screen folds it again. Both choices are kept in `ovis:mirror-wrap`. - **Back to driving:** the grid is fitted again and unfolded. - **Under the keyboard at another device's grid:** folded, cursor row in view, a Korean preedit drawn over the folded rows, panned by wheel and by swipe. Once the keyboard goes, the catch-up fit unfolds it. What fails without the change: - On origin/main the script fails at `foldState(watching)`: `{"folded":false}`. - Each mutation of the change fails at the assertion that names it: dropping the keyboard case, showing the menu item only for mirrors, gating the keyboard fold on "no mouse reporting", and the first commit without the scroll fixes (`scrollTop` stuck under the keyboard). - All of #1961's mirror assertions still pass, including the preedit-topmost check. Other checks: - `src/lib/terminalFold.test.ts`: the `wideGrids` store keeps a pane wide while any terminal that draws it says so. - `bun run check fast` is green on a091b37 (unit tests: 7176 pass, 0 fail). Real apps were run against an isolated test herdr (`bun run check run`) with an omp-like pane (long Korean lines, a status box) and btop. A 1700 px desktop client held the pane at 174x53. The phone was a device paired to watch: the server reported `via: device, role: watch`. "Before" is an origin/main server and "after" is this branch's. | Device | origin/main | This branch | |---|---|---| | Headless Chrome, watching, 390x844, 412x915, 915x412, 844x390 | 174 columns, every row end cut, 1365 px to pan | folded, every row end in view, nothing to pan sideways | | Android app 1.0 (3), WebView 145, 412x915 dp portrait and 957x411 landscape, watching | omp and btop cut off | folded. A real tap on the tab ⋯ opens Original width; an adb swipe pans it (scrollLeft 535); Wrap to screen folds it again | | Android app, driving with the keyboard up, then the desktop takes the pty back | the desktop's 174 columns, cut off | folded. Text typed with adb reaches the pane and shows in the fold. With the keyboard gone the phone takes the pane back at 50x49, unfolded | | iOS Simulator app (built from main), iPhone 17e, watching | - | folded | | Headless Chrome, driving, 412x915 | redrawn at 50 columns | the same: 50x44, not folded, no menu item | Screenshots and the Korean summary for the maintainer (tailnet): http://100.123.228.51:7593/ ## Reviews An `omo-native-code-reviewer` pass approved with notes, and a Codex (gpt-6.1-sol, xhigh) pass ran on the first commit. Neither found anything HIGH. | Finding | Resolution | |---|---| | Codex MEDIUM: a keyboard-held fold kept `overflow: hidden`, so a wheel could not pan it | overflow-y on every fold; the regression wheels it, and the first commit fails there | | Codex MEDIUM: a touch on a keyboard-held fold scrolled the pane instead of panning the folded rows | a touch pans the folded rows up to their edges first; covered by a real swipe | | Codex LOW: "pans sideways" set `scrollLeft` directly | real swipes and wheels | | Reviewer MEDIUM: a keyboard-held fold eats taps meant for a mouse program | tried gating on mouse reporting. The real Android app then showed that herdr's attach reports the mouse for every pane, so the gate turned the fold off everywhere. Reverted and documented as a trade-off (Original width keeps clicks); the fixture now replays herdr's modes, and the gate makes the script fail | | Reviewer MEDIUM: the first "driving is never folded" checks only test the fit | relabelled as fit checks; driving→unfolded is covered after watching and after the keyboard | | Reviewer LOW: stale `wideGrids` key after a pane switch; comments; the geometry push before the keyboard step; try/finally in the unit test | fixed | ## Known limits - A line the PC program already wrapped at the pane's width folds again (as in #1961 and Collie). - A full-screen TUI is hard to read folded. Original width is there for it. - The iOS Simulator runs headless on the test MacBook Air, with no taps or rotation, so iOS was checked in portrait only. Android covered the toggle and landscape. --------- Co-authored-by: mp <mp@local>
Refs #1537 (item 2; item 1 was fixed by #1749). ## Change - **`.github/workflows/windows-terminal-qa.yml`** runs `scripts/windows-terminal-browser-qa.ts`, the native Windows mirrored-terminal check (PowerShell history under the wheel, touch drag and tap, horizontal panning across output, text and IME input at a phone's width), which ran in no workflow: - GitHub-hosted `windows-latest` only, `contents: read`, no secrets: a fork's PR never reaches the self-hosted runners. - herdr 0.9.3 from its release zip, checked against a pinned SHA-256 (CI's herdr everywhere else); Bun through `./.github/actions/setup-ci`; the lockfile's Playwright Chromium (cached). - Every external action pinned by commit SHA, like the rest. - Runs on PRs that touch the mirror, the terminal components, gesture/viewport helpers, settings, the xterm patch or `setup-ci`; weekly on main; and on a manual dispatch. Not a required check. The test herdr's log is kept as an artifact when it fails. - **The script itself was broken on current main**: since #1961 a mirrored pane wider than a phone folds to the screen by default, so its 390 px panning steps had nothing to pan. It now picks Original width (`ovis:mirror-wrap` = false) before loading, and waits until the grid overflows before panning, so a folded grid fails with that message instead of a 15 s timeout. - **Two more script fixes the first runner runs found**: cleanup no longer replaces the run's own error (the closed pane's PowerShell holds the test folder for a moment: EBUSY, now waited for, bounded at 15 s), and the IME edge check places its caret by the measured cell width instead of a fixed 52 columns, which on the runner's font put the caret cell across the phone's edge (the xterm patch rightly treats a cut cell as off screen). - `docs/development.md`, the script's header, `ci-browser.test.ts`'s manual-list comment and a changelog fragment say where it runs. ## Not changed (items 3-5 of #1537) - **3, hidden pane gets a 1 px textarea width**: only when the host has no box (`display: none` or zero size), where nothing can be typed. Panes the canvas hides use `visibility: hidden` (`PaneCanvas.css:24`), keep their box and get real bounds; the `.xterm-screen` ResizeObserver resyncs when a box returns. No observable defect found. - **4, the bounds type written inline in the xterm patch**: a tidy-up with no behaviour change; left out to keep this PR to the workflow. - **5, a layout read per host scroll event while bounds apply**: scrolling leaves layout clean, so the read does not force a reflow; only a scroll during composition does. Not measured; no defect found. ## Verification - **Windows terminal QA green on 5f80b63, all four PASS lines: https://github.com/devswha/ovis/actions/runs/40647753903** (and on ef4c78d: https://github.com/devswha/ovis/actions/runs/40646709409). Earlier runs on this PR (40645679178, 40646211178) failed on the two script issues above. The same script also passed 4/4 on the maintainer's Windows 11 PC in a fresh clone. - `bun run check fast` green on 953e43f and again on ef4c78d (workflow syntax/actionlint, typecheck, build, unit tests, incl. `scripts/ci-setup.test.ts` pin checks). - Reviews: omo-native-code-reviewer PASS on 2dd4acd (MEDIUM: trigger list too narrow - fixed in 953e43f; MEDIUM: workflow not yet run - this PR's run). Codex Sol 6.1 Fast xhigh BLOCK on 2dd4acd (HIGH: the mirror fold above; MEDIUM: trigger list) - both fixed in 953e43f; its re-review of 953e43f: PASS; its review of the two script fixes (953e43f..ef4c78d): PASS. ## Merge This changes `.github/workflows`: **the merge waits for the owner's go**, which Dori will ask for with this PR's link.
…ith main (#2253) Fixes the **Native Windows mirrored terminal** check (`windows-terminal-qa.yml`, from #2211) failing on #2243 and #2242 at `Timed out: new native output after wheel pan` (and an `EBUSY` that hid the error), while it passed on #2246. ## Root cause The workflow checked out `github.event.pull_request.head.sha`. A branch cut before #2211 (524273e) ran **its own old copy** of `scripts/windows-terminal-browser-qa.ts`, against an app that already folds a wide mirrored pane to a phone's width (#1961). #2211 fixed that script in four places: it chooses Original width (`ovis:mirror-wrap` = false), waits for the grid to overflow, places the IME caret by the measured cell width, and retries the EBUSY cleanup. The old copy still has all of them. #2243 (base b48c66a) and #2242 (base 615c92b) predate #2211; #2246 (base 84824f1) does not. The workflow file itself comes from the merge ref, so the job ran on those PRs anyway. Nothing in the product is wrong: the failing PRs tested a stale script. ## Change - `windows-terminal-qa.yml` checks out `${{ github.sha }}`: the pull request's merge with its base, as every job in `ci.yml` does. Schedule and dispatch runs are unchanged (they already fell back to `github.sha`). `windows-install.yml` keeps the head SHA for its own reason (`install.ps1 -Ref` must name the checked-out commit); this workflow builds and runs the checkout in place. - `scripts/ci-setup.test.ts`: the QA job's checkout ref must be `${{ github.sha }}`. It fails on main (`Received: "${{ github.event.pull_request.head.sha || github.sha }}"`) and passes with the change. - `docs/development.md` and a changelog fragment say so. ## Verification Native Windows 11 VM (`winvm`, herdr 0.9.3, Bun 1.4.2), fresh `%TEMP%` clones, through `dori heavy`: | Checkout | Script | Result | | --- | --- | --- | | #2243 head 457f187 | its own (pre-#2211), plus diagnostics | **0/3**: all time out at `new native output after wheel pan` (one hides it behind EBUSY, as on #2242). Diagnostics: herdr's pane shows `PPP…> Q`, while the host has `scrollWidth 390 == clientWidth 390`, so the grid is folded, not at Original width | | #2243 head 457f187 | its own plus only `ovis:mirror-wrap = false` | wheel-pan step **3/3 PASS**; then each run fails at `a visible cursor keeps its composition anchor`, the fixed-52-column bug #2211 also fixed | | `refs/pull/2243/merge` 3493d80 (what this workflow now checks out) | current | **3/3 PASS**, all four PASS lines | | main 5c20a88 | current | **10/10 PASS** in a row, all four PASS lines each | - GitHub runner, all green with four PASS lines: - this PR's own run, which checked out `Merge d1bea76 into adfdef6` (7e74dbd), i.e. the merge: https://github.com/devswha/ovis/actions/runs/40688443672 - a manual dispatch on this branch: https://github.com/devswha/ovis/actions/runs/40688514345 - a manual dispatch on main adfdef6: https://github.com/devswha/ovis/actions/runs/40688525315 - `bun run check fast` green (workflow syntax/actionlint, typecheck, build, unit tests: 8163 pass, 0 fail) on this head, d1bea76. ## Reviews - omo-native-code-reviewer: **PASS**, no CRITICAL/HIGH/MEDIUM. LOW notes, left as is: "Re-run jobs" reuses the original merge commit (as in `ci.yml`; a push or reopen picks up a newer base); "merge with main" is strictly the merge with the base branch (PRs here target main); the test's `!` would throw a TypeError instead of a clean failure if the checkout step were removed, as in its neighbours. - Codex Sol 6.1 Fast xhigh: **PASS**, no findings. Its note: the step still depends on echo and mirror delivery within 15 s, so the same timeout label on a current-base PR would be a new cause (a real regression or a starved runner), not this one.
Problem
Beta testers of the iOS and Android apps said the terminal looks "a bit cut off". The owner's screenshots show which kind: an omp pane in the terminal lens has every line cut off on the right, and the pane keeps the PC's width. Collie, on the same phone and the same pane, wraps the lines to the phone's width.
The PC is a Windows PC. herdr has no
terminal attachthere yet (herdrdev/herdr#4821), so the bridge mirrors a pane: it repaintspane.readat the pane's own size on that PC (pane-geometrywithfixed: true,server/mirror.ts). A phone cannot resize that pane, and drew the grid 1:1 with the rest panned off to the right. Panes of Linux and macOS PCs are attached and take the phone's width, so they were not affected.Fix
Client only; the server, herdr and the way devices share a pane's size are unchanged, so this does not wait on the 0.4.17 release hold for
server/andshared/.src/lib/terminalFold.tsdraws a mirrored grid wider than its mount again as text that wraps at the screen's width: each row's cells as coloured SGR runs in awhite-space: pre-wrapblock over the grid. The xterm grid stays at the pane's size, unseen, so everything that reads it (the masked-prompt detector, the input row reader, Find) still reads what herdr drew. Colours follow the theme (xterm's own sixteen where a theme names none) and the grid's minimum contrast. Korean words fold whole (word-break: keep-all).terminalMirrorWrap, a device setting, not collected by telemetry). Until the user chooses, a narrow screen (a touch screen, or 768 px and under) folds and a desktop keeps the original width.Design precedent: the apps this repo compares against (Codex, Claude, Zed, Warp…) all size their terminal to the window, which a mirror cannot do. This follows Collie (AltanS/collie,
web/src/components/ansi-output.tsx), which draws herdr's pane read as SGR runs in a pre-wrap block and never resizes the pane. No code is taken from it. DESIGN.md has the entry beside the existing mirrored-grid one.Validation
bun scripts/mirror-fold-demo-regression.ts(new, in the browser lane), a 120x40 fixed mirror on demo fixtures with its PC flagged as a mirror the way a Windows PC is:top, this fails:topmost: terminal-fold-row);390px phone: rows cut off on the right ["END1 at 911-943 of 0-390", ...]. On this branch's first commit (before the review fixes) it fails:the grid's cursor row stays in view under the folded rows {"top":-1227,"bottom":-1210,"viewTop":97,"viewBottom":796}.src/lib/terminalFold.test.ts: palette and grey ramp, the contrast lift, dim, row runs without herdr's padding, wide glyphs, escaping, bold-bright, link and column lookup for taps.scripts/mirror-scroll-demo-regression.ts,scripts/narrow-pane-demo-regression.ts, settings, wheel and conventions tests;bun run check fastgreen on the head commit (unit 7147 pass, 0 fail).origin/mainand this branch, the same pane (an omp-like screen with Korean text and a box status line, and btop) in a 144-column herdr window.terminalMirrorWrap=false)Screenshots and the Korean summary for the maintainer: (shared privately with the maintainer)
Reviews
An
omo-native-code-reviewerpass (approve with notes) and a Codex (gpt-6.1-sol, xhigh) adversarial pass ran on the first commit, and a second Codex pass on the follow-up. Every finding below is resolved, the regression checking each behaviour:top(.xtermis already relative); the regression's preedit check fails with the transformKnown limits