Skip to content

fix(powerline): detect Nerd Fonts v3 names and fonts in font subfolders - #739

Open
axisrow wants to merge 1 commit into
sirmalloc:mainfrom
axisrow:fix/powerline-font-detection
Open

axisrow wants to merge 1 commit into
sirmalloc:mainfrom
axisrow:fix/powerline-font-detection

Conversation

@axisrow

@axisrow axisrow commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #738. checkPowerlineFonts() missed three common layouts:

Layout Example Detected before
Nerd Fonts v3 names (no spaces) JetBrainsMonoNerdFont-Regular.ttf ✗
Nerd Fonts v3 short form JetBrainsMonoNF-Regular.ttf ✗
Fonts in subfolders ~/.local/share/fonts/NerdFonts/..., Debian /usr/share/fonts/opentype/PowerlineSymbols.otf ✗

The same font file is detected under its old v2 name (JetBrains Mono Regular Nerd Font Complete.ttf) and reported missing under its v3 name — only the name differs (repro and screenshot in #738).

Changes, all around checkPowerlineFonts (src/utils/powerline.ts):

  • Patterns: /nerd font/i becomes /nerd ?font/i, plus an NF token check (nf followed by a separator, digit, or end of name). All existing patterns are untouched.
  • Scan: the pattern list and the folder walk are extracted into exported helpers (powerlineFontPatterns, fontFolderHasPowerlineFont); the walk recurses into subfolders with readdirSync(..., { withFileTypes: true }), hidden entries skipped, depth-capped at 5. checkPowerlineFonts keeps its platform path list and just asks the helper.

This also matters for the font-safe separator fallback discussed in #604: any fallback keyed on this detection would misfire for these setups, replacing working glyphs with |.

Terminals with built-in Powerline glyphs (Ghostty, kitty, WezTerm) stay out of scope here — see the follow-up note in #738.

Test plan

  • New src/utils/__tests__/powerline-font-detection.test.ts drives the exported scanner against real temporary directories (no module mocks): every layout above is detected, the spaced v2 name still is, hidden subfolders and unrelated fonts are not. On the pre-fix code the file fails to import (fontFolderHasPowerlineFont is new).
  • bun run lint is clean.
  • bun test: 3175 pass, 1 fail — a pre-existing flaky timeout in usage-fetch.test.ts (a real-subprocess probe that hit its 5s budget under load; unrelated to this PR).

🤖 Generated with Claude Code

checkPowerlineFonts() scanned only the top level of the font folders and
required a spaced "nerd font" pattern, so common layouts were reported as
missing: Nerd Fonts v3 file names have no spaces
("JetBrainsMonoNerdFont-Regular.ttf"), the short "NF" form exists
("JetBrainsMonoNF-Regular.ttf"), and font managers nest fonts in
subfolders ("NerdFonts/", "TTF/", Debian's
/usr/share/fonts/opentype/PowerlineSymbols.otf).

Match "nerd ?font" and an "NF" token, and scan the font folders
recursively with a depth cap.

Co-Authored-By: Claude Code <noreply@anthropic.com>
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.

Powerline font detection misses Nerd Fonts v3 names, the NF short form, and fonts in subfolders

1 participant