Skip to content

fix(web): keep terminal font settings reliable - #5397

Merged
juliusmarminge merged 5 commits into
pingdotgg:mainfrom
StiensWout:t3code/fix-advanced-terminal-font
Aug 5, 2026
Merged

fix(web): keep terminal font settings reliable#5397
juliusmarminge merged 5 commits into
pingdotgg:mainfrom
StiensWout:t3code/fix-advanced-terminal-font

Conversation

@StiensWout

@StiensWout StiensWout commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The typography controls could leave the terminal in two incorrect font states:

  • Advanced mode still inherited an unset terminal family from the code-font preference, so changing Code changed active terminals.
  • Custom terminal faces were checked before their styles loaded. A proportional face could pass through the monospace fallback, then render against a fixed cell grid after loading, leaving glyphs behind the cursor and link underline.

Fix

  • inherit the code family only in simple typography mode; Advanced uses the terminal preference or terminal default
  • load every style the canvas renderer can request before accepting a custom terminal family
  • validate regular, bold, italic, and bold-italic advances across representative glyphs, including the space glyph
  • repeat fixed-width validation when later font-loading events arrive
  • keep terminal previews and default labels aligned with runtime resolution
  • cover simple/Advanced preference resolution, fixed advances, and post-load rejection with regression tests

Validation

  • full GitHub Actions test suite
  • vp run --filter @t3tools/web typecheck
  • targeted vp lint --report-unused-disable-directives on changed files
  • targeted vp fmt and git diff --check
  • direct Node runtime assertion for strict advance validation

Follow-up to #5103.

Generated with GPT-5.6 Sol in the Codex harness.


Note

Medium Risk
Touches terminal rendering metrics and font validation timing; some fonts that passed the old two-glyph check may now be rejected or fall back after load.

Overview
Fixes terminal typography so Advanced mode no longer ties an empty terminal font to the code font (code changes no longer move the live terminal), while simple mode still inherits the monospace preference for the terminal.

The Ghostty canvas path now preloads normal/bold/italic variants before accepting a custom face, and tightens monospace checks via areFontAdvancesMonospace across multiple glyphs and styles (not just i vs M). Late fonts.loadingdone events re-run validation and can fall back if a proportional face loads after an earlier pass.

Settings previews and the terminal drawer share resolveTerminalFontPreference and TYPOGRAPHY_ADVANCED_STORAGE_KEY so UI matches runtime behavior.

Reviewed by Cursor Bugbot for commit 6d25c32. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix terminal font settings to load style variants before measuring and applying fonts

  • Introduces loadTerminalFontFamily in surface.ts to await all relevant font style variants before validating and applying a terminal font, replacing direct document.fonts.load calls.
  • GhosttyTerminalSurface.setFont now uses an epoch counter to let the newest font request win, avoiding race conditions from overlapping async loads.
  • Adds resolveTerminalFontPreference to appearanceFonts.ts: in simple mode the terminal inherits the code font; in advanced mode it uses the terminal font setting independently.
  • Adds areFontAdvancesMonospace as a reusable tolerance-based monospace check that fails open when canvas metrics are unavailable; isMonospaceFamily now checks multiple style variants and rejects a family if any variant measures as proportional.
  • Behavioral Change: initial terminal grid metrics are now measured after font styles finish loading, which may delay first render slightly but improves layout accuracy.

Macroscope summarized 6d25c32.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb7faec0-b271-47f5-81fe-6822c8532528

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 5, 2026
Comment thread apps/web/src/appearanceFonts.ts Outdated
@StiensWout StiensWout changed the title fix(web): keep advanced terminal font separate from code fix(web): keep terminal font settings reliable Aug 5, 2026
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 5, 2026
@StiensWout
StiensWout marked this pull request as ready for review August 5, 2026 11:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3838e53. Configure here.

Comment thread apps/web/src/terminal/ghostty/surface.ts
@macroscopeapp

macroscopeapp Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 6d25c32

Bug fix for terminal font settings with focused scope: improves font loading validation, fixes advanced/simple typography mode resolution, and enhances monospace detection. Changes are well-tested and the author owns this code area.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge
juliusmarminge merged commit 2a04db1 into pingdotgg:main Aug 5, 2026
17 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 5, 2026
## What's Changed
* fix(web): keep model picker shortcuts in sync by @t3dotgg in pingdotgg/t3code#5400
* fix(web): keep terminal font settings reliable by @StiensWout in pingdotgg/t3code#5397


**Full Changelog**: pingdotgg/t3code@v0.0.32-nightly.20260805.1005...v0.0.32-nightly.20260805.1006

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.32-nightly.20260805.1006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants