fix(terminal): apply configured font size on startup - #146
Open
maartengoet wants to merge 1 commit into
Open
Conversation
loadConfig seeds tabBarPosition, hideTabTitles, terminalOpacity and the AI session limits from config, but never terminal.fontSize, so the store kept its hardcoded initial 14. TerminalPanel does construct xterm with the configured size, but its fontSize effect immediately writes the stale store value back over it on mount. Any configured size other than 14 was therefore lost on every launch - through the Settings control just as much as through the config file - and only came back via updateConfig or zoomReset (Ctrl+0). The status-bar zoom badge divides the store value by the configured baseline, so the mismatch also surfaced as a wrong percentage: a configured 17.5 rendered at 14px and displayed 80%. Seed fontSize from config.terminal.fontSize in loadConfig, guarded on a positive number so a malformed value falls back to the default. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
The bug
A terminal font size other than 14 does not survive a restart. On every launch the terminal renders at 14px regardless of
terminal.fontSize, and the status-bar zoom badge shows a wrong percentage.This affects the Settings font-size control just as much as editing
tmax-config.jsondirectly — the Settings change applies to the running session and is silently lost on the next start.Repro: quit tmax, set
terminal.fontSizeto17.5(any value ≠ 14 reproduces), start tmax.Expected: terminal renders at 17.5px, badge reads
100%.Actual: terminal renders at 14px, badge reads
80%— exactly14 / 17.5.Root cause
loadConfig(src/renderer/state/terminal-store.ts) seedstabBarPosition,hideTabTitles,hideTabCloseButtons,confirmOnCloseSession,terminalOpacityand the AI session limits from config into the store — but neverterminal.fontSize. The store keeps its hardcoded initialfontSize: 14.TerminalPaneldoes construct xterm with the configured size, but the effect that reacts to the store'sfontSizewrites the stale 14 straight back over the instance on mount, so the configured value never survives.The store's
fontSizewas only ever reconciled with config in two places, neither of which runs at startup:updateConfig— runtime config changes, i.e. the Settings dialogzoomReset— Ctrl+0That also explains the misleading badge: its numerator is the stale store value while its denominator is the freshly loaded config baseline.
The fix
Seed
fontSizefromconfig.terminal.fontSizeinloadConfig, alongside the fields it already copies. Guarded on a positive number so a malformed value falls back to the default rather than rendering an unusable terminal.Ctrl+0 keeps working unchanged — it reads the same baseline, which the store now already matches at startup.
Testing
New unit suite
tests/unit/renderer/load-config-font-size.test.ts(6 cases): seeding from config, a configured value equal to the default, config without aterminalsection, non-numeric input, zero/negative input, and config still being stored alongside the seeded size.Verified red/green — reverting the one-line seed fails 2 of the 6, applying it passes all 6.
npm testlocally: 171 passed. Two failures intelemetry-pingare pre-existing on macOS and unrelated — they assert hardcodedC:\Users\...paths and fail identically on a clean checkout ofmain.No cross-platform surface: no modifier keys, shortcut text, paths or shell assumptions involved.
🤖 Generated with Claude Code