From 59a9b44e2fd0f939d0bae11e36d44b2f7005edd7 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Mon, 22 Jun 2026 20:24:11 -0700 Subject: [PATCH] Fix terminal font chooser filtering (#6121) --- ...ngsFormControls.font-autocomplete.test.tsx | 29 +++++++++++++++++++ .../settings/SettingsFormControls.tsx | 8 ++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx b/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx index c2cab9dce..f7f43cff2 100644 --- a/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx +++ b/src/renderer/src/components/settings/SettingsFormControls.font-autocomplete.test.tsx @@ -82,6 +82,35 @@ describe('FontAutocomplete', () => { ).toBe('JetBrains Mono') }) + it('shows the full list on focus when the committed font has multiple matching suggestions', async () => { + function Harness(): ReactNode { + const [value, setValue] = useState('Cascadia Mono') + return ( + + ) + } + + await act(async () => { + root.render() + }) + + await act(async () => { + getInput().focus() + }) + + expect(getOptionLabels()).toEqual([ + 'Arial', + 'Cascadia Code', + 'Cascadia Mono', + 'Cascadia Mono PL', + 'Consolas' + ]) + }) + it('keeps typed searches filtered even after the value updates', async () => { function Harness(): ReactNode { const [value, setValue] = useState('Geist') diff --git a/src/renderer/src/components/settings/SettingsFormControls.tsx b/src/renderer/src/components/settings/SettingsFormControls.tsx index 6af9a0f95..d60a72c69 100644 --- a/src/renderer/src/components/settings/SettingsFormControls.tsx +++ b/src/renderer/src/components/settings/SettingsFormControls.tsx @@ -630,12 +630,10 @@ export function FontAutocomplete({ () => filterFontSuggestions(suggestions, query), [suggestions, query] ) - // Why: a committed font fills the input, but typed searches can also mirror - // into `value`; only expand exact matches outside an active search session. + // Why: the committed font fills the input, but opening the chooser should + // still reveal every installed font instead of only fonts sharing that name. const visibleSuggestions = - !isFilteringQuery && normalizedQuery === normalizedValue && filteredSuggestions.length <= 1 - ? suggestions - : filteredSuggestions + !isFilteringQuery && normalizedQuery === normalizedValue ? suggestions : filteredSuggestions // Why: sync the highlighted index during render rather than via useEffect so // the correct item is highlighted on the very first paint after open/filter