You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(settings): let the terminal font size field accept typed values - #53268
In Settings → Terminal → Font size, you couldn't type a new size. The box snapped back after every keystroke because Orca threw away anything that wasn't already a valid size, including the "1" you type on the way to "16". Now you can type freely. Valid sizes still preview right away, and the final value is checked when you press Enter or leave the box.
What Changed
Before: the input's value was bound straight to the stored terminalFontSize, and onChange ignored anything outside 10–24. So every partial number was dropped and the field re-rendered the stored size.
After (TerminalFontSizeSetting.tsx):
The field keeps a nullable string draft. null means the field hasn't been touched and shows the stored size, so outside changes (steppers, import, another window) still show up, even while the field is focused but unedited.
Typing sets the draft. Valid in-range values are still written live, so the terminal previews as you type.
On blur or Enter, the draft is parsed, clamped to 10–24 (30 → 24, 5 → 10), and written only if it differs. Non-numeric text reverts to the current size. Then the draft goes back to null.
Because an untouched field never commits, focusing and blurring doesn't overwrite an imported fractional size like 13.5. A late live write from the settings round trip also can't overwrite newer keystrokes, since the field shows the draft while you're editing.
The 10/24 bounds are now named constants, and the steppers use the existing clampNumber helper.
Why
The bug comes from binding a controlled number input to a value that rejects intermediate states. A local draft that is committed on blur or Enter fixes that at the source. A nullable draft avoids a prop-to-state sync during render, so the field can't fall out of step with the store.
N/A for a recording: the field looks the same before and after, and the only change is how typing behaves. Component tests that drive the real component with keystrokes cover that behavior. 4 of 7 repro cases fail on main and all 7 pass here (see Testing).
Testing
Repro suite (Testing Library, deferred store that mimics the IPC round trip). On main, 4 cases fail: typing 1 then 16, clamping on blur and reverting garbage, a late live write overwriting newer keystrokes, and an outside change while focused overwriting an edit. On this branch, all 7 pass. Focus+blur without edits not rewriting an imported size and steppers still syncing the field pass on both.
Verify suite with user-event real keystrokes, 10/10 passing: select-all then typing 16; backspace then 20 + Enter; 5 + Tab → 10; 99 + blur → 24 with one write; no duplicate write after a live 24; slow IPC keeping 16 visible; a late 16 not overwriting 18; imported 13.5 + stepper; an unfocused field following an outside change; 12.7 → 12.
Static gates on the changed file all pass: oxlint, oxfmt, anti-slop, code-quality native plugins, ast-grep, and the changed-code quality gate.
Platforms: tested in a renderer unit environment on macOS. The change is plain React input handling with no platform-specific code.
Original fix by @AymanKhan9. Maintainer follow-ups keep imported sizes and outside changes intact and guard against late live writes.
Performance
None that matters. This is a settings field, not a hot path, and the change only adds one piece of local state. In a synthetic per-keystroke benchmark, each change took about 0.09 ms on the branch vs 0.075 ms on main, with the worst single change at 0.13 ms vs 1.6 ms, far under 16 ms. Each keystroke now does about 1.1 React commits vs 0.41, because the draft updates on every keystroke. Nothing scales with the number of tabs or panes, and there is no new IPC, I/O, or polling.
Risk
Level: Low
Only this field's input handling changes. The stored setting, its 10–24 range, and the steppers behave the same. The worst case is the field showing a draft that differs from the stored size until blur or Enter, which is the intended editing behavior. Back out with a plain revert.
Review
Cross-platform: the same input behavior on every platform.
SSH/remote: none.
Agents and integrations: none.
Security: none.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
The terminal font size field now stores input in a local draft. Valid values from 10 through 24 still update settings while typing. On blur or Enter, the field keeps the current setting for invalid text, clamps parsed values to the allowed range, and clears the draft. The increment and decrement buttons also use the shared clamping helper.
Severity of issue fixed: Medium
Merge Risk: Low · up to d0cc3
The terminal font size field now accepts typed values, but exotic numeric input such as 1e2 is read as 1 and saved as 10. A stale typed value can also overwrite a font size changed in another window. Both are low-impact edge cases in a single setting.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: the terminal font size field now accepts typed values. It uses a conventional fix(scope) prefix and is 67 characters, within a normal length. The raw summary confirms …
Description check
The description follows the repository template closely. It covers ELI5, What Changed (before and after), Why, a Linked Issue (Fixes #53267), Visual Proof marked N/A with a reason, Testing, Performanc…
Linked Issues check
[#53267] requires that typing a valid font size works in Settings > Terminal > Font size, that valid 10-24 values apply live, and that the draft is clamped or reverted on blur or Enter. Code at the re…
Out of Scope Changes check
Comparing the base file with the head file shows changes limited to TerminalFontSizeSetting.tsx. The changes are: a useState import, the draft state and commitDraft helper, onBlur and `onKeyDown…
Full details: Title check
Explanation
The title names the main change: the terminal font size field now accepts typed values. It uses a conventional fix(scope) prefix and is 67 characters, within a normal length. The raw summary confirms the change to TerminalFontSizeSetting: a draft string, live apply for valid 10–24 values, and commit on blur or Enter.
Full details: Description check
Explanation
The description follows the repository template closely. It covers ELI5, What Changed (before and after), Why, a Linked Issue (Fixes #53267), Visual Proof marked N/A with a reason, Testing, Performance, Risk with level, AI Disclosure, Review, the upstream boundary checkbox, Notes, and the Checklist. The Testing section explains the manual throwaway test and why no test was committed. Two gaps remain. The 'Fixes #' issue number is filled in, so this is fine, but the 'Level' field is filled as Low, which is acceptable. The manual testing box is unchecked, and the lint/typecheck/test/build checklist item is unchecked, with an explanation that the full typecheck did not finish. The reviewer should confirm these before merge. The description is mostly complete and clear.
Full details: Linked Issues check
Explanation
[#53267] requires that typing a valid font size works in Settings > Terminal > Font size, that valid 10-24 values apply live, and that the draft is clamped or reverted on blur or Enter. Code at the reviewed head (TerminalFontSizeSetting.tsx) meets each point. (1) The input value is draft ?? fontSize, so intermediate keystrokes such as 1 stay in the field. (2) onChange stores the raw draft, then calls updateSettings only when the parsed value is within 10-24, so typing 16 applies 16 live. (3) commitDraft, run on onBlur and on Enter, clamps numeric drafts (for example 30 becomes 24), reverts an unparseable draft such as an empty field to the current size, updates the store only when the result differs, and resets the draft to null. (4) A null draft means untouched, so the field follows outside changes to the stored size. The +/- buttons now use clampFontSize, which gives the same results as the prior Math.max/Math.min logic for integer sizes. The issue does not require committed tests. The author's throwaway test is not a requirement here. No code path at head contradicts the issue. Note: the whole-PR diff tool was unavailable. This verdict relies on the head file, the base file, and the PR summary.
Full details: Out of Scope Changes check
Explanation
Comparing the base file with the head file shows changes limited to TerminalFontSizeSetting.tsx. The changes are: a useState import, the draft state and commitDraft helper, onBlur and onKeyDown handlers on the font size input, the value and onChange rewrite, and shared MIN_TERMINAL_FONT_SIZE/MAX_TERMINAL_FONT_SIZE constants with a clampFontSize helper. The constants and helper support the #53267 objective by removing duplicated literals from the same field's logic. The step-button rewrite keeps the same disabled conditions and bounds. The import of clampNumber from terminal-theme is a supporting dependency for the clamp helper. No unrelated file or behavior change appears in the evidence. The whole-PR diff tool was unavailable, so this conclusion relies on the base and head file contents and the PR summary.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Parse the complete numeric draft before clamping.
With the setting at 14, paste 1e2 and blur the input. Exponent notation is valid numeric input, but parseInt reads only 1. The new commit path therefore saves 10 instead of clamping 100 to 24. (html.spec.whatwg.org)
Use complete numeric conversion and retain an explicit empty-input fallback. Based on learnings, avoid prefix-only parsing when the complete numeric value is required.
The font size input bound its value straight to the stored setting and
dropped any keystroke outside 10-24, so typing 16 lost the leading 1 and
the field snapped back. Keep a draft while the user edits, still apply
valid sizes live, and clamp the draft on blur or Enter. An untouched
field keeps following the stored size, so outside changes and imported
fractional sizes are not overwritten on blur.
Fixesstablyai#53267
Co-authored-by: Neil <[email protected]>
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Keep an outside font-size update from being overwritten by a stale draft.
While a draft is active, the input shows the draft and ignores settings.terminalFontSize. If another window changes the stored size during that time, the field keeps showing the old typed value. A later blur or Enter then writes that stale draft over the newer value.
The field should show and commit the stored value after an outside change. The draft should only be committed when the user edited it after the last outside change. The exact mechanism is a design choice, so no code change is proposed here.
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
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.
ELI5
In Settings → Terminal → Font size, you couldn't type a new size. The box snapped back after every keystroke because Orca threw away anything that wasn't already a valid size, including the "1" you type on the way to "16". Now you can type freely. Valid sizes still preview right away, and the final value is checked when you press Enter or leave the box.
What Changed
Before: the input's
valuewas bound straight to the storedterminalFontSize, andonChangeignored anything outside 10–24. So every partial number was dropped and the field re-rendered the stored size.After (
TerminalFontSizeSetting.tsx):draft.nullmeans the field hasn't been touched and shows the stored size, so outside changes (steppers, import, another window) still show up, even while the field is focused but unedited.30→24,5→10), and written only if it differs. Non-numeric text reverts to the current size. Then the draft goes back tonull.13.5. A late live write from the settings round trip also can't overwrite newer keystrokes, since the field shows the draft while you're editing.clampNumberhelper.Why
The bug comes from binding a controlled number input to a value that rejects intermediate states. A local draft that is committed on blur or Enter fixes that at the source. A nullable draft avoids a prop-to-state sync during render, so the field can't fall out of step with the store.
Linked Issue
Fixes #53267
Visual Proof
N/A for a recording: the field looks the same before and after, and the only change is how typing behaves. Component tests that drive the real component with keystrokes cover that behavior. 4 of 7 repro cases fail on
mainand all 7 pass here (see Testing).Testing
main, 4 cases fail: typing1then16, clamping on blur and reverting garbage, a late live write overwriting newer keystrokes, and an outside change while focused overwriting an edit. On this branch, all 7 pass. Focus+blur without edits not rewriting an imported size and steppers still syncing the field pass on both.user-eventreal keystrokes, 10/10 passing: select-all then typing16; backspace then20+ Enter;5+ Tab → 10;99+ blur → 24 with one write; no duplicate write after a live24; slow IPC keeping16visible; a late16not overwriting18; imported13.5+ stepper; an unfocused field following an outside change;12.7→12.Original fix by @AymanKhan9. Maintainer follow-ups keep imported sizes and outside changes intact and guard against late live writes.
Performance
None that matters. This is a settings field, not a hot path, and the change only adds one piece of local state. In a synthetic per-keystroke benchmark, each change took about 0.09 ms on the branch vs 0.075 ms on
main, with the worst single change at 0.13 ms vs 1.6 ms, far under 16 ms. Each keystroke now does about 1.1 React commits vs 0.41, because the draft updates on every keystroke. Nothing scales with the number of tabs or panes, and there is no new IPC, I/O, or polling.Risk
Level: Low
Only this field's input handling changes. The stored setting, its 10–24 range, and the steppers behave the same. The worst case is the field showing a draft that differs from the stored size until blur or Enter, which is the intended editing behavior. Back out with a plain revert.
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)