fix(powerline): fall back to a plain | separator when no Powerline font is detected - #13
Merged
Merged
Conversation
…nt is detected Powerline/Nerd Font glyphs (private-use area) render as mojibake when the terminal has no matching font; checkPowerlineFonts() could detect this, but only the TUI setup flow surfaced it. Now every powerline separator, cap, and user-typed separator character is checked at render time: PUA glyphs degrade to '|' when no font is detected and pass through untouched otherwise. Detection is a directory scan, cached for the process lifetime; installing fonts through the TUI resets the cache. Tests can pin the detection via setCachedPowerlineFontStatus() so renders stay deterministic regardless of the machine's fonts. Closes the bug half of sirmalloc#604. Co-Authored-By: Claude Code <noreply@anthropic.com>
This was referenced Sep 27, 2026
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.
Closes the bug half of sirmalloc#604 (the feature half is handled by sirmalloc#607).
Problem
The default powerline separator is the private-use-area glyph U+E0B0. Without a Powerline/Nerd Font it renders as mojibake, and while
checkPowerlineFonts()can detect the absence of fonts, that warning only surfaced in the TUI setup flow — enabling powerline via config/CLI on a machine without fonts produced garbage glyphs in every render with no hint of the cause. Regular-mode separators suffer the same when users type PUA characters as their separator.Fix
Render-time font-safe pass, applied to:
separators,startCaps,endCaps(renderer's powerline path);characteranddefaultSeparator(renderer's regular path).Mechanics:
fontSafeSeparator(): text containing a PUA glyph (BMP PUAU+E000–F8FFplus the astral Nerd Font planes) degrades to'|'when the detection reports no font; everything else passes through untouched, and glyphs are kept when a font is detected.checkPowerlineFonts(), a directory scan) is cached for the process lifetime so renders stay cheap;installPowerlineFonts()resets the cache so newly installed fonts stop the fallback.setCachedPowerlineFontStatus()is a small test seam: tests pin the detection result, so renderer output is deterministic regardless of the machine's fonts (several existing glyph-asserting tests now seedinstalled: true).Known limitation
Detection is disk-based (font directories + name patterns) — it cannot know which font the terminal actually uses. A machine with a Nerd Font installed on disk but a non-Nerd font selected in the terminal will keep the glyphs (and the mojibake). Surfacing a hint in that case would need a config knob or TUI message; left out to keep this change small.
Verification
separator-font-fallback.test.ts: glyph detection (BMP + astral), fallback with fonts absent, pass-through with fonts present, and full renders in powerline mode and regular mode (PUA separator character) asserting|and noU+E0B0.renderer-dim,renderer-flex-width) pinned via the test seam — all green.bun testfull suite: only the pre-existing timing-flaky subprocess tests flicker (pass in isolation);bun run lintclean;bun run buildOK.U+E0B0separators rendered through the built binary on a font-less machine emits|and zero mojibake bytes.🤖 Generated with Claude Code