Repository navigation
fix(ghostty): keep the first font-family when importing config #16090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,11 +211,28 @@ export function mapGhosttyToOrca( | |
| return { key: 'terminalCursorOpacity', value: num } | ||
| }, | ||
|
|
||
| 'font-family': (v) => { | ||
| if (typeof v !== 'string' || v.trim().length === 0) { | ||
| // Why: Ghostty treats a repeated font-family as a fallback chain — the first | ||
| // entry is the primary face, the rest are fallbacks. The generic flattening | ||
| // above keeps the LAST occurrence, which is the right default for keys where | ||
| // a later line overrides an earlier one, but here it picks the least-preferred | ||
| // face. Read the unflattened value and take the first usable entry instead. | ||
| // | ||
| // An empty entry is not a blank to skip over: Ghostty documents it as | ||
| // resetting the list ("specify the value as \"\" to reset the list and then | ||
| // set the new values"), so only the entries after the LAST reset are still | ||
| // in effect. Searching the whole array would import a face the user cleared. | ||
| 'font-family': (v, rawValue) => { | ||
| if (!Array.isArray(rawValue)) { | ||
| return typeof v === 'string' && v.trim().length > 0 | ||
| ? { key: 'terminalFontFamily', value: v } | ||
| : null | ||
| } | ||
| const lastReset = rawValue.map((entry) => entry.trim().length === 0).lastIndexOf(true) | ||
| const first = rawValue.slice(lastReset + 1).find((entry) => entry.trim().length > 0) | ||
| if (typeof first !== 'string') { | ||
| return null | ||
| } | ||
| return { key: 'terminalFontFamily', value: v } | ||
| return { key: 'terminalFontFamily', value: first } | ||
|
Comment on lines
+224
to
+235
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Allow trailing blank entries to reach the When Proposed fix- if (!value.trim()) {
+ if (key !== 'font-family' && !value.trim()) {
unsupportedKeys.push(key)
continue
} |
||
| }, | ||
|
|
||
| 'font-size': (v) => { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.