Repository navigation
fix(ghostty): import the primary font-family from a repeated fallback list - #37292
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou'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. View limit details
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. |
nwparker
force-pushed
the
nwparker/fix-ghostty-font-family-first
branch
from
November 2, 2026 03:02
4359b61 to
dba1d99
Compare
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ghostty treats a repeated
font-familyas a fallback list: the first entry is the primary font, andfont-family = ""resets the list. Orca's Ghostty import flattened every repeated key to its last occurrence, so a config likeMenlo+MonacoimportedMonaco, which is a fallback.Root cause and fix (
src/main/ghostty/):mapper.ts: thefont-familyparser 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 listsfont-family (fallback fonts not preserved)under unsupported keys, following the existingbackground-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.ghosttyand the legacyconfig),font-familynow appends to the list as Ghostty does, using the same rulepalettealready had, instead of letting the later file replace the earlier one.Why only the first entry and not a CSS stack:
terminalFontFamilyholds one family.buildFontFamilywraps the whole value in quotes as a single name, then appends Orca's own monospace fallbacks. A joinedMenlo, Monacowould 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
font-familyimports exactly as before.unsupportedKeys, which is already a free-formstring[]rendered as a list, so older and newer clients both render it.Negative user-facing tradeoffs
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, andoxfmtare clean on the changed files.ORCA_BACKGROUND_LAUNCH=1, CDP port 9351, throwawayHOME,XDG_CONFIG_HOMEand user-data dir):config.ghostty=Menlo,Monaco; legacyconfig=Courier New. On main this importsCourier New.Menloand the unsupported keyfont-family (fallback fonts not preserved). After Apply Changes,settings.terminalFontFamily === 'Menlo'and the Font Family field shows Menlo.Menlo,"",Monaco, the preview importedMonaco.Menlo,"", the preview imported no font and listedfont-familyas unsupported.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-familylines, realistically fewer than 10), run once per preview. There is nothing meaningful to measure. Bundle impact is a few lines in the main chunk.