Repository navigation
fix(dashboard): scale preview terminal font instead of CSS transform - #13103
brennanb2025 wants to merge 2 commits into
Conversation
When the PTY grid is owned elsewhere (live pane, phone), the agent terminal preview keeps the source cols/rows and shrank the whole rendered terminal with transform: scale(<1) — resampling every glyph into visible smear (the 'Orca text is blurry' reports; measured advance 8.4 vs the crisp 8.0 in the same screenshot). Shrink the font size instead: same grid, no rewrap, glyphs rasterize natively at the final size. A residual transform remains only for the sliver the half-px font step cannot express and below the 4px floor. The base font is restored when the box grows or the grid claim succeeds, and the appearance effect re-runs the fit after rewriting fontSize.
📝 WalkthroughWalkthroughAdds a preview terminal fit-scale planner that adjusts font size and residual CSS scaling. Adds a scheduler that validates measurements, remeasures after font changes, anchors the terminal based on cursor visibility, and coalesces requests with 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
|
Electron QA on exact HEAD Claim-denied path:
Source pane owning the wide grid: Claim-denied preview, crisp via font fitting: Smaller settled preview: Restored larger preview: |
|
Closing without merging, deliberately. Post-review reality check: this fix was motivated by a field screenshot that turned out to be a different bug entirely (a normal pane with a stale-dpr canvas backing — fixed and merged as #13159). With that attribution corrected, this PR has zero field reports behind it, and the transform-scale fallback it fixes only engages when the preview's grid claim is denied — in practice a phone-paired PTY or a mid-dialog host reclaim, since the claim machinery parks even a live pane and renders the dialog 1:1 crisp in normal desktop use. The mechanism was never reproduced under real usage. The branch (brennanb2025/preview-font-scale-blur) stays. Reopen criteria: a report of smeared text in the agent terminal dialog while the PTY grid is owned elsewhere (most plausibly a phone-paired agent), at which point the fix must first be validated against a real reproduction of that state — the planner unit tests here verify the math, not the trigger. |




Summary
Fixes a standing blur in the agent terminal preview. (Correction: an earlier revision of this description attributed the Aug 7 field screenshot to this surface — that screenshot is a regular split pane, and its blur is still under investigation. This PR stands on its own: the preview's claim-denied path has always rendered smeared.) When the PTY grid is owned elsewhere (the live pane in the worktree, a phone),
AgentTerminalPreviewcorrectly keeps the source cols/rows (replaying serialized ANSI into different dimensions rewraps into garbage) but shrank the whole rendered terminal withtransform: scale(<1)— resampling every glyph into smear. Measured signature of the CSS-scaled path: stretched character advance with lumpy resampled edges versus the crisp floored-advance rendering of an unscaled terminal.The preview now shrinks the font size instead: same grid (no rewrap), glyphs rasterize natively at the final size. A residual CSS transform remains only for the sliver the half-px font step cannot express (≤2%, imperceptible) and below a 4 px readability floor. The base font is restored when the box grows or the grid claim succeeds, and the settings-appearance effect re-runs the fit after it rewrites
fontSize. Fit-scale planning lives in a pure module (preview-terminal-fit-scale.ts) with a measure→apply→measure oscillation guard; the fit/anchor logic moved topreview-terminal-fit.ts(also keeps the component under its max-lines cap). Cursor anchoring behavior is unchanged.Screenshots
Visual before/after on a live claim-denied preview is owed at review time (needs a grid owned by a live pane). The fix makes the preview rasterize at the final size, which removes the resample step entirely.
Testing
pnpm lintpnpm typecheckpnpm test— targeted: fullsrc/renderer/src/components/dashboard-popout/suite (207 tests) green locally; full suite left to CIpnpm build— left to CIoptionsbag the fit path reads/writesAI Review Report
Reviewed by the implementing agent. Main risks checked: (1) rewrap — cols/rows are never touched; only
fontSizechanges, which re-renders cells without reflowing the buffer; (2) oscillation — the planner holds the current font within a 2% tolerance and rounds to half-px steps, so measure→apply→measure settles in one pass with the residual transform absorbing rounding; (3) appearance-settings clobber — the appearance effect rewritesfontSizefrom settings, so it now re-schedules the fit through a ref (nulled on unmount); (4) restore path — when the box grows orcreatePreviewGridClaimresizes the terminal to fit, the plan clamps back to the settings base font and drops the transform; (5) anchor math — cursor anchoring uses the residual scale against post-font-change measurements, preserving the top/bottom anchoring contract. Cross-platform: renderer-only, DOM renderer (the preview never takes WebGL), no shortcuts/labels/paths/shell/Electron platform differences; fractional CSS font sizes render fine on macOS/Linux/Windows.Security Audit
Renderer-internal layout logic only. No input handling, command execution, path handling, auth, secrets, dependency, or IPC changes.
Notes
transform: scale(<1)fallback has been the preview's fit strategy since the component was extracted in perf(sidebar): stabilize worktree card props so cards memo-bail on order-preserving epoch bumps #9392. feat(dashboard-popout): size the terminal dialog's PTY to the dialog grid #9997 already identified the scaled path as blurry ("rendered the pane's serialized frame at its original cols/rows and CSS-scaled it down to fit") and narrowed it by claiming the PTY grid for the dialog box — this PR fixes the remaining claim-denied fallback (grid owned by a live pane or phone). No recent changes to the grid-claim arbitration made this more common; it was always the owned-grid behavior.