Skip to content

fix(ghostty): import the primary font-family from a repeated fallback list - #37292

Merged
nwparker merged 3 commits into
mainfrom
nwparker/fix-ghostty-font-family-first
Nov 2, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/fix-ghostty-font-family-first

Conversation

@nwparker

@nwparker nwparker commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​16 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10

Summary

Ghostty treats a repeated font-family as a fallback list: the first entry is the primary font, and font-family = "" resets the list. Orca's Ghostty import flattened every repeated key to its last occurrence, so a config like Menlo + Monaco imported Monaco, which is a fallback.

Root cause and fix (src/main/ghostty/):

  • mapper.ts: the font-family parser now reads the unflattened value, finds the entries after the last "" reset, and imports the first of them.
  • mapper.ts: when more than one fallback is active, the import preview lists font-family (fallback fonts not preserved) under unsupported keys, following the existing background-blur (radius value not preserved) pattern. The loss is no longer silent, which was the issue's other ask.
  • index.ts: across config files (config.ghostty and the legacy config), font-family now appends to the list as Ghostty does, using the same rule palette already had, instead of letting the later file replace the earlier one.

Why only the first entry and not a CSS stack: terminalFontFamily holds one family. buildFontFamily wraps the whole value in quotes as a single name, then appends Orca's own monospace fallbacks. A joined Menlo, Monaco would become one font that doesn't exist. Supporting a real stack would mean changing that consumer and the settings UI, which also affects remote and mobile clients that read the same setting. That is out of scope here.

Closes #15985

Supersedes #16090 by @maxmilian. That PR took the same first-entry-after-reset approach, which this one adopts. This PR also reports the dropped fallbacks and handles lists split across config files.

Merge risk: Low

  • The change only runs on the user-triggered Ghostty import path (main-process parsing, then a preview modal). Nothing runs at startup or in the render loop.
  • No settings schema or migration change, and existing stored settings are untouched. A config with a single font-family imports exactly as before.
  • The only cross-version surface is unsupportedKeys, which is already a free-form string[] rendered as a list, so older and newer clients both render it.
  • Cross-platform: pure string logic. The cross-file merge applies to whichever config paths discovery returns on each OS.

Negative user-facing tradeoffs

  • Ghostty fallback fonts beyond the primary are still not imported. They are now reported in the preview instead of being dropped silently.
  • A config whose list ends in font-family = "" imports no font (reported as unsupported) and does not reset Orca's font to the default. This matches the previous behavior for an empty value.

Validation

  • pnpm test src/main/ghostty: 7 files, 135 tests pass. The new mapper test fails on main (expected 'Monaco' to be 'Menlo') and passes on this branch.
  • pnpm tc:node, oxlint, and oxfmt are clean on the changed files.
  • Real app (dev build, ORCA_BACKGROUND_LAUNCH=1, CDP port 9351, throwaway HOME, XDG_CONFIG_HOME and user-data dir):
    • Setup: config.ghostty = Menlo, Monaco; legacy config = Courier New. On main this imports Courier New.
    • Opened Settings, searched "Ghostty", clicked Import from Ghostty. The preview showed Font Family Menlo and the unsupported key font-family (fallback fonts not preserved). After Apply Changes, settings.terminalFontFamily === 'Menlo' and the Font Family field shows Menlo.
    • With Menlo, "", Monaco, the preview imported Monaco.
    • With Menlo, "", the preview imported no font and listed font-family as unsupported.
  • Review: one Opus sub-agent review found no correctness issues. Its one nit, reporting the dropped fallbacks, is implemented here. Codex (gpt-6.1-sol, xhigh) reviewed the final head and had no findings.

Perf

Scanned the diff against the perf-scan checklist. The change is on a one-shot, user-initiated main-process import path with no runtime hot path, renderer change, polling, subscriptions or new IPC. The added work is an O(n) scan over one config key's entries (n is the number of font-family lines, realistically fewer than 10), run once per preview. There is nothing meaningful to measure. Bundle impact is a few lines in the main chunk.

after-preview

after-applied

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 839a55f8-0c1a-4899-810b-c6c1d5c35ed1
Commits

Reviewing files that changed from the base of the PR and between 5bbbdeb and dba1d99.

Files selected for processing: 3
  • src/main/ghostty/index.ts
  • src/main/ghostty/mapper.test.ts
  • src/main/ghostty/mapper.ts
  • 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.

Share

@nwparker
nwparker force-pushed the nwparker/fix-ghostty-font-family-first branch from 4359b61 to dba1d99 Compare November 2, 2026 03:02
@nwparker
nwparker merged commit 37ce11a into main Nov 2, 2026
42 checks passed
@nwparker
nwparker deleted the nwparker/fix-ghostty-font-family-first branch November 2, 2026 03:27
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.

[Bug]: Ghostty import keeps the last font-family instead of the first

1 participant