From c8d1414d513c951445d127b69e9640255c444844 Mon Sep 17 00:00:00 2001 From: njk Date: Tue, 11 Aug 2026 15:20:24 -0500 Subject: [PATCH] TerminalFont (Ghostty): fix font-family fallback order --- src/detection/terminalfont/terminalfont.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/detection/terminalfont/terminalfont.c b/src/detection/terminalfont/terminalfont.c index 8c54a85009..463abeed76 100644 --- a/src/detection/terminalfont/terminalfont.c +++ b/src/detection/terminalfont/terminalfont.c @@ -98,13 +98,17 @@ static void parseGhosttyConfig(FFstrbuf* path, FFstrbuf* fontName, FFstrbuf* fon while (ffStrbufGetline(&line, &len, &buffer)) { if (ffParsePropLine(line, "font-family =", &temp)) { FF_DEBUG("found font-family='%s' in %s", temp.chars, path->chars); - // Latter overrides former; former becomes the fallback font - if (fontName->length > 0) { - ffStrbufDestroy(fontNameFallback); - ffStrbufInitMove(fontNameFallback, fontName); + // Ghostty appends to a fallback list; the first entry is the primary font. + // An empty value resets the list. + if (temp.length == 0) { + ffStrbufClear(fontName); + ffStrbufClear(fontNameFallback); + } else if (fontName->length == 0) { + ffStrbufSet(fontName, &temp); + } else if (fontNameFallback->length == 0) { + ffStrbufSet(fontNameFallback, &temp); } - ffStrbufDestroy(fontName); - ffStrbufInitMove(fontName, &temp); + ffStrbufClear(&temp); } else if (ffParsePropLine(line, "font-size =", &temp)) { FF_DEBUG("found font-size='%s' in %s", temp.chars, path->chars); // Latter overrides former