Compare commits

...
Author SHA1 Message Date
Cursor Agentand陈大猫 6a26547dc0 fix(fonts): allow the glued SFMono family in the picker (#3929)
Windows enumerates "SFMono Nerd Font" (name ID 16). The allowlist only
had "sf mono", and suffix matching requires a mono word boundary, so
the family was dropped.

Co-authored-by: 陈大猫 <binaricat@users.noreply.github.com>
2026-10-25 14:30:03 +00:00
2 changed files with 19 additions and 0 deletions

No files matched your search

+16
View File
@@ -80,6 +80,22 @@ describe('queryLocalFonts deduplication', () => {
assert.ok(!names.includes('Microsoft YaHei UI'));
});
it('recognizes SFMono Nerd Font as a monospace terminal font (#3929)', async () => {
installMockWindow(async () => [
{ family: 'SFMono Nerd Font' },
{ family: 'SF Mono' },
{ family: 'Segoe UI' },
]);
const monoFonts = await getMonospaceFonts();
const names = monoFonts.map((f) => f.name);
// Glued typographic family (name ID 16) and the spaced family both belong.
assert.ok(names.includes('SFMono Nerd Font'));
assert.ok(names.includes('SF Mono'));
assert.ok(!names.includes('Segoe UI'));
});
it('a second sequential call also reuses the resolved promise (no second API call)', async () => {
let callCount = 0;
installMockWindow(async () => {
+3
View File
@@ -37,6 +37,9 @@ const KNOWN_MONOSPACE_FONTS = new Set([
'victor mono',
'ibm plex mono',
'sf mono',
// Nerd Font / patched builds often use the glued typographic family
// "SFMono Nerd Font" (name ID 16), which does not match "sf mono" (#3929).
'sfmono',
'operator mono',
'input mono',
'pragmata pro',