Skip to content

feat(editor): add an opt-in Editor Font Size setting - #30088

Closed
nivaldomcj wants to merge 5 commits into
stablyai:mainfrom
nivaldomcj:feat/editor-font-size
Closed

nivaldomcj wants to merge 5 commits into
stablyai:mainfrom
nivaldomcj:feat/editor-font-size

Conversation

@nivaldomcj

Copy link
Copy Markdown

ELI5

The code editor always used the terminal's font size, so a bigger editor meant a bigger terminal too. This adds an "Editor Font Size" setting. Leave it empty and nothing changes. Set it, and the editor gets its own size while the terminal keeps its size.

What Changed

Before: every editor surface used terminalFontSize + editorFontZoomLevel. The only editor-only control was the ⌘= / ⌘- zoom, which stores a hidden offset from the terminal size.

After: General → Editor has an Editor Font Size row, right after Editor Font Family. It is a clearable number field (10–24 px, the same range as Terminal Font Size). Its grey placeholder shows the terminal size that an empty field follows.

  • Empty (the default): the editor follows the terminal size exactly as before.
  • Set: the editor uses that size as its base. Changing the terminal size no longer moves the editor.
  • Editor zoom (⌘= / ⌘-) still adds on top of the base, within the existing 8–32 px clamp.

Mechanism:

  • src/shared/global-settings-types.ts: new optional editorFontSize?: number. There is no default entry, so a missing value means "follow the terminal". This is the same shape as terminalMinimumContrastRatio. Clearing the field writes undefined.
  • src/renderer/src/lib/editor-font-zoom.ts: new resolveEditorBaseFontSize(settings), next to resolveEditorFontFamily. It returns editorFontSize when it is a finite number above 0, otherwise terminalFontSize ?? 13. The finite check matters because computeEditorFontSize passes NaN through its clamp, and a hand-edited settings file could hold a bad value.
  • These surfaces now call the resolver instead of settings?.terminalFontSize ?? 13: MonacoEditor, MonacoCodeExcerpt, DiffViewer, DiffSectionItem, IpynbCellEditor (preview and active cell), AutomationEditorPromptEditor, and zoom-ipc-bridge.ts, so the zoom overlay percentage uses the same base.
  • New EditorFontSizeSetting.tsx uses the existing NumberField with onClear (its first consumer). The row and the General → Editor search gate read one shared entry, getEditorFontSizeSearchEntry() in general-editor-search.ts, the same way WslHostsExperimentalSetting does. A localized keyword can therefore never open the section while hiding the row.
  • Strings are in all six locales (en, es, fr, ja, ko, zh).
  • The Auto Save Delay input now has an aria-label (reusing its existing "Auto Save Delay" string). GeneralPane.section-lifetime.test.tsx found that input as "the only spinbutton in the section", which is no longer true. The test now finds it by name.

Out of scope: surfaces that never followed the terminal size keep their fixed base: the notebook Markdown cells and outputs (13 px, IpynbViewer.tsx), the Markdown preview and the rich Markdown editor (14 px).

Why

The terminal and the editor serve different purposes, and many people want a compact terminal next to a more readable editor. Today the only lever is the terminal size, or a hidden zoom offset that still moves with the terminal.

I considered showing the existing editorFontZoomLevel in Settings instead. It is a smaller diff, but it presents a relative "+3" as a setting and keeps the editor tied to the terminal. An absolute, opt-in size follows the pattern Orca already uses for Editor Font Family (#9658): empty follows the terminal, so existing users see no change and no migration is needed.

Linked Issue

Fixes #30084

Visual Proof

Before: Settings search "editor font" finds only Editor Font Family.

1-before-settings-editor-font

After: the new Editor Font Size row. When it is empty, the grey placeholder shows the terminal size it follows (14 here).

2-after-settings-editor-font-size-empty

After: the row set to 18.

3-after-settings-editor-font-size-18

After: a file at 18 px next to a terminal at 14 px.

4-after-editor-18px-next-to-terminal-14px

Testing

Platform tested: macOS (Apple Silicon) only. The change is renderer-only and has no platform-specific code.

Manual check in pnpm dev, with a sample repo (TypeScript, Python, JSON, CSS, Markdown, a notebook, and uncommitted changes for the diff views):

  1. Editor field empty: the file editor follows the terminal size, as before.
  2. Editor set to 18: the file editor, single diff, combined diff and notebook code cells show 18. The terminal is unchanged.
  3. Terminal size changed: the editor stays at 18.
  4. ⌘= in the editor: it grows on top of 18.
  5. Field emptied: the editor follows the terminal again.
  6. Restarted the app: the value persists.
  7. Settings search "font size": the row shows.

Automated tests:

  • editor-font-zoom.test.ts: the resolver follows the terminal when unset, uses the override, ignores NaN, Infinity, 0 and negative values, falls back to 13, and stacks zoom on top.
  • New MonacoEditor.font-size.test.tsx: Monaco receives fontSize from the terminal when unset, from editorFontSize when set, plus zoom.
  • New EditorFontSizeSetting.test.tsx: empty field with the terminal size as placeholder, commit, clamp to 10–24, clearing writes undefined, and the row stays visible for every keyword that opens its section.
  • general-editor-search.test.ts: "editor font size", "font size", "text size" and "editor" reach the row through both search gates.
  • zoom-routing.test.ts: the editor zoom overlay percent uses editorFontSize when set (20 px + 1 = 105%).

Local gates:

  • pnpm lint: pass. After I installed mobile/ dependencies for pnpm build, audit:code-quality:native also reports import(no-cycle) warnings in mobile/src/transport and mobile/src/terminal/document. This PR does not touch those files, and the run before that install passed. Every other lint step passes.

  • CI changed-code gate (node config/scripts/check-changed-code-quality.mjs <base>): pass.

  • pnpm typecheck: pass.

  • pnpm test: all tests in src/renderer pass. The full run had 57 failures in 23 files, none in src/renderer and none importing a changed module. They are environment failures on this Mac: missing pg in cloud/, /private/var vs /var paths, macOS bash 3.2 unbound variable, zsh/PTY startup timeouts, and lock contention in the cross-version harness. I did not re-run them on a clean main.

  • pnpm build: every JavaScript step passes (typecheck, CLI, electron-vite, web client, mobile web). build:native fails locally because the Command Line Tools ship arm64-only Swift compatibility libraries, so the x86_64 slice of native/notification-status-macos cannot link. The change touches no native code, and CI with full Xcode covers it.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Written with Claude Code. Research used Claude Sonnet 5.5. Planning, implementation, tests and these texts used Claude Opus 5.5. I reviewed the plan, ran the manual checks, and approved each step.

Review

Four independent AI reviewers ran on the diff: CodeRabbit, OpenAI Codex (gpt-6.1-sol, high effort), Kimi (K2.8) and a cold Claude Opus reviewer. Kimi and Claude rated the patch correct. Six findings in total. I checked each against the code:

  • Fixed: four type assertions in the new tests failed the CI changed-code gate (Codex). They are now typed declarations and checked narrowing.
  • Fixed: in a non-English UI, the new localized search keyword opened the Editor section but hid the row, because the row kept its own English-only keywords (Claude). The row and the section gate now share one entry.
  • Closed: duplicated per-surface size calculation, and the new Monaco test copying the font-family test's mocks (Claude). Both follow existing patterns, and changing them would widen the PR.
  • Closed: two findings about code that predates this PR (CodeRabbit).

Summary by the authoring agent:

  • Cross-platform: renderer-only. No paths, shortcuts, menus or platform checks changed. NumberField is the same shared control on every platform.
  • SSH / remote / local: the setting is a global UI preference read in the renderer. It does not depend on where the worktree lives, so local, SSH and WSL worktrees behave the same. Writes go through the existing settings update path that desktop IPC, web RPC and the CLI already share.
  • Agents and integrations: none touched. The automation prompt editor follows the new base like the other editors.
  • Mobile: no mobile code changed. build:mobile-web passes.
  • Backward compatibility: unset keeps the exact old value (terminalFontSize ?? 13). There is no default entry and no migration. An older Orca reading a newer settings file ignores the extra key.
  • Performance: resolveEditorBaseFontSize is a pure function that returns a number primitive inside option objects that each surface already builds on render. It adds no new object identities, listeners, timers, IPC or I/O.
  • Security: the value is a number. The UI clamps it to 10–24, the resolver rejects non-finite or non-positive values, and computeEditorFontSize clamps the final size to 8–32. A value outside 10–24 written through the settings file or the CLI still ends inside 8–32.
  • UI quality: the row reuses SearchableSetting and NumberField, the house form controls, and sits next to Editor Font Family. All strings are translated.

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

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)
  • 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)

🤖 Generated with Claude Code

@nivaldomcj nivaldomcj changed the title Feat/editor font size feat(editor): add an opt-in Editor Font Size setting Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d4f0b858-a87a-49c1-a9a1-fd143ae7651b
Commits

Reviewing files that changed from the base of the PR and between 504725d and 2f47c94.

Files selected for processing: 20
  • src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx
  • src/renderer/src/components/editor/DiffSectionItem.tsx
  • src/renderer/src/components/editor/IpynbCellEditor.tsx
  • src/renderer/src/components/editor/MonacoCodeExcerpt.tsx
  • src/renderer/src/components/editor/MonacoEditor.tsx
  • src/renderer/src/components/settings/GeneralEditorSettingsSection.tsx
  • src/renderer/src/components/settings/GeneralPane.section-lifetime.test.tsx
  • src/renderer/src/components/settings/general-editor-search.test.ts
  • src/renderer/src/hooks/ipc-events/zoom-ipc-bridge.ts
  • src/renderer/src/hooks/zoom-routing.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/editor-font-zoom.ts
  • src/shared/editor-font-settings.ts
  • src/shared/global-settings-base.ts
  • src/shared/global-settings-types.ts
Files with no reviewable changes: 1
  • src/shared/global-settings-types.ts
Files skipped from review as they are similar to previous changes: 6
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The changes add an optional editor font size setting, bounded from 10 to 24 px. When unset or invalid, the editor uses the terminal font size, or 13 if no terminal size is set. Editor zoom continues to adjust the resolved base size. The setting is available in General Editor settings and search, with localized labels. Editor surfaces and zoom percentage reporting now use the resolved base size. Notebook previews and live editors calculate line height from the zoom-adjusted font size.

Priority: Normal

Merge Risk: Minimal · up to 2f47c

The editor font-size setting appears ready to merge after normal checks; no actionable issue remains in the reviewed changes.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: adding an opt-in Editor Font Size setting.
Description check Passed The description is complete and follows the required template. It explains the user-facing behavior, implementation, rationale, linked issue, visual proof, testing, AI disclosure, compatibility consid…
Linked Issues check Passed Issue [#30084] requires an opt-in Editor Font Size setting under General → Editor. EditorFontSizeSetting provides a clearable integer field with 10–24 bounds and uses the terminal size as the empty …
Out of Scope Changes check Passed The changes stay within issue [#30084]. Localized strings, shared editor-setting types, search metadata, persistence wiring, rendering helpers, and tests support the new setting. The Auto Save Delay l…
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Full details: Description check

Explanation

The description is complete and follows the required template. It explains the user-facing behavior, implementation, rationale, linked issue, visual proof, testing, AI disclosure, compatibility considerations, and checklist status. It also documents the local full-test and native-build failures with their reported environment causes.

Full details: Linked Issues check

Explanation

Issue [#30084] requires an opt-in Editor Font Size setting under General → Editor. EditorFontSizeSetting provides a clearable integer field with 10–24 bounds and uses the terminal size as the empty placeholder. resolveEditorBaseFontSize preserves the terminal fallback and rejects non-finite or non-positive overrides. The changed Monaco, diff, notebook code-cell, code-excerpt, automation prompt, and zoom paths use the resolver. computeEditorFontSize keeps zoom additive and clamps the result. Added tests cover the resolver, setting behavior, search, Monaco sizing, notebook sizing, and zoom routing.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue [#30084]. Localized strings, shared editor-setting types, search metadata, persistence wiring, rendering helpers, and tests support the new setting. The Auto Save Delay label and selector update keep existing settings tests stable after adding another numeric input. The reported fixed-size Markdown surfaces remain unchanged.

  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 206f01ee-964f-46f4-9e37-6b2f063e0149
📥 Commits

Reviewing files that changed from the base of the PR and between 6fcc183 and 26ce71fb0c6fa138b189dc1f4dbaec1ee08427d6.

📒 Files selected for processing: 25
  • src/renderer/src/components/automations/AutomationEditorPromptEditor.tsx
  • src/renderer/src/components/editor/DiffSectionItem.tsx
  • src/renderer/src/components/editor/DiffViewer.tsx
  • src/renderer/src/components/editor/IpynbCellEditor.tsx
  • src/renderer/src/components/editor/MonacoCodeExcerpt.tsx
  • src/renderer/src/components/editor/MonacoEditor.font-size.test.tsx
  • src/renderer/src/components/editor/MonacoEditor.tsx
  • src/renderer/src/components/editor/diff-section-item-props.ts
  • src/renderer/src/components/settings/EditorFontSizeSetting.test.tsx
  • src/renderer/src/components/settings/EditorFontSizeSetting.tsx
  • src/renderer/src/components/settings/GeneralEditorSettingsSection.tsx
  • src/renderer/src/components/settings/GeneralPane.section-lifetime.test.tsx
  • src/renderer/src/components/settings/general-editor-search.test.ts
  • src/renderer/src/components/settings/general-editor-search.ts
  • src/renderer/src/hooks/ipc-events/zoom-ipc-bridge.ts
  • src/renderer/src/hooks/zoom-routing.test.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/editor-font-zoom.test.ts
  • src/renderer/src/lib/editor-font-zoom.ts
  • src/shared/global-settings-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments: 2
src/renderer/src/lib/editor-font-zoom.ts: 1

40-41: LGTM!

src/renderer/src/components/editor/IpynbCellEditor.line-height.test.tsx: 1

93-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Move rendered line-height checks to a visual test.

previewRowHeights() reads inline CSS, and the live-cell tests also assert style.height. Happy DOM can confirm those assignments, but it cannot confirm that the rendered rows align or avoid overlap. Keep the Monaco option assertions here. Use a browser-backed visual test for preview and live-cell layout.

Based on learnings, React Testing Library tests should not assert CSS/layout properties; visual regression tests should verify layout instead.

Source: Learnings


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e3384564-f5d5-4d22-9178-9658239c5a00
📥 Commits

Reviewing files that changed from the base of the PR and between 26ce71fb0c6fa138b189dc1f4dbaec1ee08427d6 and e4cfb0833ff458ee7ad802657919875bcf169b36.

📒 Files selected for processing: 5
  • src/renderer/src/components/editor/IpynbCellEditor.line-height.test.tsx
  • src/renderer/src/components/editor/IpynbCellEditor.tsx
  • src/renderer/src/components/editor/MonacoCodeExcerpt.tsx
  • src/renderer/src/lib/editor-font-zoom.test.ts
  • src/renderer/src/lib/editor-font-zoom.ts
🚧 Files skipped from review as they are similar to previous changes: 3
  • src/renderer/src/components/editor/MonacoCodeExcerpt.tsx
  • src/renderer/src/lib/editor-font-zoom.test.ts
  • src/renderer/src/components/editor/IpynbCellEditor.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

nivaldomcj and others added 3 commits October 20, 2026 05:47
The file editor, diff views, notebook code cells and the automation prompt
editor took their font size from the terminal, so the only way to make the
editor bigger was to move the terminal too, or to use the hidden editor
zoom shortcut. Editor Font Size under General > Editor sets the editor's
base size; left empty, the editor follows the terminal size exactly as
before. Editor zoom keeps adding on top of the new base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The row kept its own English-only keywords while the General > Editor
search gate used a translated keyword, so a localized search could open
the section and hide the row. Both now read getEditorFontSizeSearchEntry().
The new tests used type assertions that the changed-code gate rejects;
they now use typed declarations and checked narrowing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Notebook code cells and PR-comment code excerpts kept a fixed 20px row
while their font followed the editor size, so at 24px adjacent lines
overlapped by 8px (17px at the 32px zoom cap). Both now take their row
height from computeEditorLineHeight, max(20, round(px * 1.45)), which
keeps every size up to 14px unchanged. A notebook cell's preview and
its Monaco editor share the value, so activating a cell still never
shifts it, and an open cell re-caps its height when zoom changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
nivaldomcj and others added 2 commits October 24, 2026 07:08
Move the editor font settings into their own group so global-settings-types.ts stays under max-lines.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@nwparker

nwparker commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #36577: every editor surface now shares one typography setup, with opt-in font size, weight, line height, ligatures and macOS smoothing. Thank you for this PR, it shaped the design.

@nwparker nwparker closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Editor Font Size setting, independent of the terminal font size

2 participants