Skip to content

Fix terminal display calibration under canvas zoom#218

Merged
DeadWaveWave merged 2 commits intomainfrom
fix/terminal-font
May 1, 2026
Merged

Fix terminal display calibration under canvas zoom#218
DeadWaveWave merged 2 commits intomainfrom
fix/terminal-font

Conversation

@DeadWaveWave
Copy link
Copy Markdown
Owner

💡 Change Scope

  • Small Change: Fast feedback, localized UI/logic, low-risk.
  • Large Change: New feature, cross-boundary logic, runtime-risk (persistence, IPC, lifecycle, recovery).

📝 What Does This PR Do?

Fixes terminal display calibration auto-reference when the workspace canvas is zoomed, and stabilizes terminal zoom-settle behavior so embedded terminal content no longer intermittently “twitches” in size during viewport zoom.

The calibration fix now makes automatic shared-reference capture use the same stable baseline measurement contract as manual Set Reference, instead of sampling transformed live terminal metrics. The zoom fix keeps DPR/output sync deferred until viewport interaction settles, reducing repeated content-size churn during active zoom gestures.

This PR also adds regression coverage for the zoomed auto-calibration path and hardens two unrelated drag E2Es that flaked during validation.


🏗️ Large Change Spec (Required if "Large Change" is checked)

1. Context & Business Logic

  • Auto shared reference previously diverged from manual reference when canvas zoom was active because it measured transformed live terminal output.
  • Terminal zoom could trigger unstable effective-DPR/output churn while viewport interaction was still active, surfacing as intermittent terminal content size twitching.
  • The intended behavior is: auto and manual reference capture must agree for the same font profile, and terminal zoom should settle to a crisp result without unstable intermediate rescaling.

2. State Ownership & Invariants

  • Settings renderer owns terminalDisplayReference persistence; mounted terminal measurements are runtime observations only.
  • Terminal node presentation owns viewport-interaction settle gating for DPR/output synchronization.
  • Invariant: automatic shared reference and manual shared reference must be derived from the same untransformed baseline measurement contract for a given terminal font profile.
  • Invariant: active viewport interaction must not repeatedly churn terminal effective DPR; the terminal applies the settled zoom update after interaction clears.
  • Invariant: terminal hydration/reload behavior must preserve mounted xterm state without remount-driven blur, geometry drift, or scrollback loss.

3. Verification Plan & Regression Layer

  • Unit: tests/unit/contexts/terminalDisplayReferenceAutoCapture.spec.tsx and useTrackpadGestures.spec.tsx cover the new auto-capture contract and settle timing.
  • E2E: added tests/e2e/settings.terminal-display-calibration.spec.ts to prove auto shared reference matches manual capture under zoom.
  • E2E: tests/e2e/workspace-canvas.terminal-device-pixel-ratio.spec.ts, tests/e2e/workspace-canvas.trackpad-gestures.spec.ts, and repeated workspace-canvas.persistence reload verification cover the zoom/twitch path.
  • Flake hardening: workspace-canvas.sidebar-drag-reorder.spec.ts and workspace-canvas.spaces.overlay-drag.spec.ts now use stable client-rect drag points and longer settle windows.

✅ Delivery & Compliance Checklist

  • My code passes the ultimate gatekeeper: pnpm pre-commit is completely green.
  • I have signed the CLA if required (see CLA.md).
  • I have included new tests to lock down the behavior (or explicitly stated why it is untestable).
  • I have strictly adhered to the DEVELOPMENT.md architectural boundaries.
  • I have attached a screenshot or screen recording (if this touches the UI).
  • I have updated the documentation accordingly (if adding a feature or changing a contract).

Current validation note: all terminal-related unit/E2E coverage listed above passed locally. Full pnpm pre-commit was blocked by unrelated agent E2E failures outside this change scope, including workspace-canvas.agent-last-message-copy.opencode.spec.ts and workspace-canvas.agent-status-watcher.spec.ts.

📸 Screenshots / Visual Evidence

Not attached in the CLI-created PR body. Terminal-specific Playwright evidence is available locally from validation runs, and I can add UI captures in the GitHub UI if needed.

@DeadWaveWave DeadWaveWave merged commit 697b353 into main May 1, 2026
7 checks passed
@DeadWaveWave DeadWaveWave deleted the fix/terminal-font branch May 1, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant