Skip to content

fix(settings): keep full installed font list - #7581

Merged
AmethystLiang merged 4 commits into
stablyai:mainfrom
mmarabel:fix/font-picker-installed-fonts-7573
Jul 7, 2026
Merged

AmethystLiang merged 4 commits into
stablyai:mainfrom
mmarabel:fix/font-picker-installed-fonts-7573

Conversation

@mmarabel

@mmarabel mmarabel commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #7573.

  • keep the complete installed font-family list in settings state instead of truncating it to 320 entries
  • share the merge behavior through mergeFontSuggestions() so both terminal and interface font pickers use the same complete source list
  • increase the macOS font-list timeout so large system_profiler SPFontsDataType -json results do not fall back to the curated defaults too early
  • add regression coverage for fonts past the previous cutoff and autocomplete search against late-list entries

Root 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_profiler can 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.tsx
  • pnpm 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.tsx
  • pre-commit hook ran oxlint, oxlint --config config/oxlint-react-doctor.json, and oxfmt --write on staged files
  • manual dev-app check: searching zap in the terminal font picker shows late-list fonts such as Zapfino instead of No matching fonts

Note: pnpm exec tsgo --noEmit -p config/tsconfig.web.json was attempted before this branch and failed on existing project file-list errors involving src/main/ipc/worktree-* imports from renderer tests; unrelated to this change.

@mmarabel
mmarabel marked this pull request as ready for review July 6, 2026 17:37
@AmethystLiang
AmethystLiang self-requested a review July 6, 2026 19:41

@AmethystLiang AmethystLiang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ee248ea2-3744-4f7e-9fe3-5debcf5c4300

📥 Commits

Reviewing files that changed from the base of the PR and between 31e9e4a and dd6aabe.

📒 Files selected for processing (2)
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/store/slices/worktrees.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/settings/Settings.tsx

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Change Summary
SettingsConstants.ts/.test.ts Added mergeFontSuggestions helper and test
Settings.tsx Replaced eager font loading effect with lazy requestFontSuggestions, mount/in-flight/loaded refs, uses mergeFontSuggestions
AppearancePane/.test.tsx, AppearanceInterfaceSection.tsx, TerminalAppearanceSection.tsx Added and wired onRequestFontSuggestions prop through component tree
settings-form-option-filter.ts/.test.ts Added FONT_SUGGESTION_RENDER_LIMIT, RenderedFontSuggestion type, getRenderedFontSuggestions and tests
SettingsFormControls.tsx/.font-autocomplete.test.tsx Wired onRequestSuggestions, capped rendering via renderedSuggestions/sourceIndex, added tests
system-fonts.ts/.test.ts Added MAC_SYSTEM_FONT_LIST_TIMEOUT_MS, timeoutMs param on execFileText, parameterized timeout tests
worktrees.ts Added null-safe fallback for missing ptyIdsByTabId

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
Loading

Related PRs: None identified.

Suggested labels: enhancement, tested

Suggested reviewers: Not determinable from provided data.

Poem
A rabbit hops through fonts anew,
No longer fetching without cue,
Three hundred twenty, capped in sight,
Yet highlighted ones still shine bright,
On Macs the clock now ticks longer too. 🐰🕐

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, root cause, and validation, but omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including screenshots or 'No visual change', the AI review report, a security audit summary, and notes.
Out of Scope Changes check ⚠️ Warning The worktree purge null-safety change is unrelated to the font-picker fix and appears outside the linked issue scope. Split the worktree slice change into a separate PR unless it is required for this font-list fix.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: preserving the full installed font list in settings.
Linked Issues check ✅ Passed The changes keep the full font source list, move rendering caps to visible suggestions, and add coverage, satisfying #7573.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4a4939c6-2fec-4d68-9a72-29670301a934

📥 Commits

Reviewing files that changed from the base of the PR and between 4cbf699 and 31e9e4a.

📒 Files selected for processing (13)
  • src/main/system-fonts.test.ts
  • src/main/system-fonts.ts
  • src/renderer/src/components/settings/AppearanceInterfaceSection.tsx
  • src/renderer/src/components/settings/AppearancePane.test.tsx
  • src/renderer/src/components/settings/AppearancePane.tsx
  • src/renderer/src/components/settings/Settings.tsx
  • src/renderer/src/components/settings/SettingsConstants.test.ts
  • src/renderer/src/components/settings/SettingsConstants.ts
  • src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx
  • src/renderer/src/components/settings/SettingsFormControls.tsx
  • src/renderer/src/components/settings/TerminalAppearanceSection.tsx
  • src/renderer/src/components/settings/settings-form-option-filter.test.ts
  • src/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.
@AmethystLiang
AmethystLiang merged commit 98d850a into stablyai:main Jul 7, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* 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]>
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.

[Bug]: Terminal font family picker truncates installed font list

2 participants