Repository navigation
feat(desktop): let monospace text use its own preferred font - #265
Merged
Zongwei9888 merged 1 commit intoOct 21, 2026
Merged
Conversation
Appearance → Settings offered one preferred-font list, and the picker's Monospace group fed the same key. `--font-mono` had no preference variable, so a face chosen there either wrote the interface stack or looked applied and changed nothing: code blocks, diffs and the small monospace labels kept the built-in stack either way. `fontFamilyMono` is now a row of `APPEARANCE_SETTINGS` with its own key, field and `--font-mono-preferred` variable, which `--font-mono` consumes as a prefix. The variable is declared empty rather than omitted, because `var()` without a fallback would make the whole `font-family` declaration invalid at computed-value time; an empty value also keeps the shipped rendering byte-identical until a font is chosen. The placeholder and the note moved onto the descriptor rows, so the table stays the one place that knows a preference's key, validation and copy — the renderer no longer keeps a second map of the two font keys, and each field writes the key it was reached through. The terminal pane is out of reach and the copy now says so: xterm paints its own canvas and takes its font from `TerminalPanel`, whose geometry is deliberately frozen because the fit addon sends its cols/rows to the PTY. Measured in Edge 153, the engine Tauri uses on Windows, against the built stylesheet: with no preference the stack is unchanged, and with one the built-in stack still follows it. The trailing comma `familyListCss` appends is what keeps `JetBrains Mono "SFMono-Regular"` from parsing as a single family name — without it the declaration is dropped and monospace text falls back to the interface font. Refs HKUDS#155.
Collaborator
|
Merged into main on 2026-10-21 as e6d1f0c ("Merge PR #265: let Desktop code text use its own preferred font"). Thank you, this is a nicely contained change. We checked it in a running Web client: with a font entered under Appearance, code text switches to it while the interface font stays the same, and the choice survives a reload. The default is unchanged and the Chinese strings are in place. Typecheck, lint and the 336 vitest tests pass. One minor thing, not blocking: a value the user ends with a comma ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New appearance setting: a preferred monospace family list, prepended to the built-in mono stack.
The trailing comma carries the mechanism: the built-in stack has no leading comma of its own, so without one the preference and the first built-in family collapse into a single bogus name and the browser drops the declaration (measured in Edge 153, the engine Tauri uses on Windows). Documented in
appearance.ts.Notes
main(f183965); the additive conflict with desktop: resize the conversation pane by dragging its edge #238'sCONVERSATION_WIDTH_RANGEkeeps both blocks.Verification
tokens.test.ts: 29/29 passed (2 new tests).tsc --noEmit: clean.appearance.test.ts: locally every test in this file dies in the sharedbeforeEachon Node 25 (localStorage.clear is not a function, Node 25's built-in localStorage). Differential-verified: cleanf183965f59fails 0/15 there; this branch 0/19 — same root cause, unrelated to this change. CI's Linux nodes are unaffected.