Repository navigation
fix(settings): keep full installed font list - #7581
Conversation
AmethystLiang
left a comment
There was a problem hiding this comment.
Thanks for the fix. I added a review follow-up that keeps the full installed font list searchable while capping rendered options, and changed the installed-font scan to load lazily only when a font picker is used.
Verified with focused tests, typecheck, changed-file lint, and Electron validation.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR reworks font suggestion loading to be on-demand instead of eager: Settings.tsx now exposes a requestFontSuggestions callback, triggered via a new onRequestFontSuggestions prop threaded through AppearancePane, AppearanceInterfaceSection, and TerminalAppearanceSection into FontAutocomplete. A new mergeFontSuggestions helper deduplicates suggestion lists. FontAutocomplete rendering is capped via a new getRenderedFontSuggestions helper and FONT_SUGGESTION_RENDER_LIMIT constant, preserving highlighted items beyond the cap. macOS system font listing also gains a longer command timeout via a new timeout parameter. A worktree purge path now handles a missing ptyIdsByTabId map safely. Changes
Sequence Diagram(s)sequenceDiagram
participant FontAutocomplete
participant TerminalAppearanceSection
participant AppearancePane
participant Settings
participant listFonts as window.api.settings.listFonts
participant mergeFontSuggestions
FontAutocomplete->>TerminalAppearanceSection: onRequestSuggestions()
TerminalAppearanceSection->>AppearancePane: onRequestFontSuggestions()
AppearancePane->>Settings: onRequestFontSuggestions()
Settings->>Settings: requestFontSuggestions()
Settings->>listFonts: listFonts()
listFonts-->>Settings: installed fonts
Settings->>mergeFontSuggestions: mergeFontSuggestions(fonts, prev)
mergeFontSuggestions-->>Settings: updated fontSuggestions
Related PRs: None identified. Suggested labels: enhancement, tested Suggested reviewers: Not determinable from provided data. Poem 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 4a4939c6-2fec-4d68-9a72-29670301a934
📒 Files selected for processing (13)
src/main/system-fonts.test.tssrc/main/system-fonts.tssrc/renderer/src/components/settings/AppearanceInterfaceSection.tsxsrc/renderer/src/components/settings/AppearancePane.test.tsxsrc/renderer/src/components/settings/AppearancePane.tsxsrc/renderer/src/components/settings/Settings.tsxsrc/renderer/src/components/settings/SettingsConstants.test.tssrc/renderer/src/components/settings/SettingsConstants.tssrc/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsxsrc/renderer/src/components/settings/SettingsFormControls.tsxsrc/renderer/src/components/settings/TerminalAppearanceSection.tsxsrc/renderer/src/components/settings/settings-form-option-filter.test.tssrc/renderer/src/components/settings/settings-form-option-filter.ts
- Latch the loaded state even when the returned font list is empty, preventing font-less systems from reissuing font listing calls on every picker interaction. - Add null-tolerance for `ptyIdsByTabId` when building worktree purge state to support callers that pass partial AppState.
* fix(settings): keep full installed font list * fix(settings): bound font picker rendering * Fix redundant font queries and handle partial state in worktree purge - Latch the loaded state even when the returned font list is empty, preventing font-less systems from reissuing font listing calls on every picker interaction. - Add null-tolerance for `ptyIdsByTabId` when building worktree purge state to support callers that pass partial AppState. --------- Co-authored-by: Jinjing <[email protected]>
Summary
Fixes #7573.
mergeFontSuggestions()so both terminal and interface font pickers use the same complete source listsystem_profiler SPFontsDataType -jsonresults do not fall back to the curated defaults too earlyRoot Cause
The renderer merged the system font list with fallback suggestions and then sliced the result to 320 entries. On systems with larger font catalogs, fonts sorted after that cutoff were removed from the source array, so searching for them returned no matches even though IPC had loaded them.
During manual validation on macOS, large font catalogs also showed that
system_profilercan take longer than 15 seconds while still succeeding, so the timeout now gives healthy scans more room while remaining bounded.Validation
pnpm exec vitest run --config config/vitest.config.ts src/main/system-fonts.test.ts src/renderer/src/components/settings/SettingsConstants.test.ts src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsxpnpm exec oxlint src/main/system-fonts.ts src/main/system-fonts.test.ts src/renderer/src/components/settings/Settings.tsx src/renderer/src/components/settings/SettingsConstants.ts src/renderer/src/components/settings/SettingsConstants.test.ts src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsxoxlint,oxlint --config config/oxlint-react-doctor.json, andoxfmt --writeon staged fileszapin the terminal font picker shows late-list fonts such asZapfinoinstead ofNo matching fontsNote:
pnpm exec tsgo --noEmit -p config/tsconfig.web.jsonwas attempted before this branch and failed on existing project file-list errors involvingsrc/main/ipc/worktree-*imports from renderer tests; unrelated to this change.