Repository navigation
feat(editor): add an opt-in Editor Font Size setting - #30088
nivaldomcj wants to merge 5 commits into
Conversation
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
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.tsxsrc/renderer/src/components/editor/DiffSectionItem.tsxsrc/renderer/src/components/editor/DiffViewer.tsxsrc/renderer/src/components/editor/IpynbCellEditor.tsxsrc/renderer/src/components/editor/MonacoCodeExcerpt.tsxsrc/renderer/src/components/editor/MonacoEditor.font-size.test.tsxsrc/renderer/src/components/editor/MonacoEditor.tsxsrc/renderer/src/components/editor/diff-section-item-props.tssrc/renderer/src/components/settings/EditorFontSizeSetting.test.tsxsrc/renderer/src/components/settings/EditorFontSizeSetting.tsxsrc/renderer/src/components/settings/GeneralEditorSettingsSection.tsxsrc/renderer/src/components/settings/GeneralPane.section-lifetime.test.tsxsrc/renderer/src/components/settings/general-editor-search.test.tssrc/renderer/src/components/settings/general-editor-search.tssrc/renderer/src/hooks/ipc-events/zoom-ipc-bridge.tssrc/renderer/src/hooks/zoom-routing.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/editor-font-zoom.test.tssrc/renderer/src/lib/editor-font-zoom.tssrc/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.
There was a problem hiding this comment.
🔇 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 assertstyle.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.tsxsrc/renderer/src/components/editor/IpynbCellEditor.tsxsrc/renderer/src/components/editor/MonacoCodeExcerpt.tsxsrc/renderer/src/lib/editor-font-zoom.test.tssrc/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.
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]>
e4cfb08 to
504725d
Compare
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]>
Co-Authored-By: Claude Haiku 5.5 <[email protected]>
|
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. |
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.
⌘=/⌘-) still adds on top of the base, within the existing 8–32 px clamp.Mechanism:
src/shared/global-settings-types.ts: new optionaleditorFontSize?: number. There is no default entry, so a missing value means "follow the terminal". This is the same shape asterminalMinimumContrastRatio. Clearing the field writesundefined.src/renderer/src/lib/editor-font-zoom.ts: newresolveEditorBaseFontSize(settings), next toresolveEditorFontFamily. It returnseditorFontSizewhen it is a finite number above 0, otherwiseterminalFontSize ?? 13. The finite check matters becausecomputeEditorFontSizepassesNaNthrough its clamp, and a hand-edited settings file could hold a bad value.settings?.terminalFontSize ?? 13:MonacoEditor,MonacoCodeExcerpt,DiffViewer,DiffSectionItem,IpynbCellEditor(preview and active cell),AutomationEditorPromptEditor, andzoom-ipc-bridge.ts, so the zoom overlay percentage uses the same base.EditorFontSizeSetting.tsxuses the existingNumberFieldwithonClear(its first consumer). The row and the General → Editor search gate read one shared entry,getEditorFontSizeSearchEntry()ingeneral-editor-search.ts, the same wayWslHostsExperimentalSettingdoes. A localized keyword can therefore never open the section while hiding the row.aria-label(reusing its existing "Auto Save Delay" string).GeneralPane.section-lifetime.test.tsxfound 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
editorFontZoomLevelin 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.
After: the new Editor Font Size row. When it is empty, the grey placeholder shows the terminal size it follows (14 here).
After: the row set to 18.
After: a file at 18 px next to a terminal at 14 px.
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):⌘=in the editor: it grows on top of 18.Automated tests:
editor-font-zoom.test.ts: the resolver follows the terminal when unset, uses the override, ignoresNaN,Infinity,0and negative values, falls back to 13, and stacks zoom on top.MonacoEditor.font-size.test.tsx: Monaco receivesfontSizefrom the terminal when unset, fromeditorFontSizewhen set, plus zoom.EditorFontSizeSetting.test.tsx: empty field with the terminal size as placeholder, commit, clamp to 10–24, clearing writesundefined, 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 useseditorFontSizewhen set (20 px + 1 = 105%).Local gates:
pnpm lint: pass. After I installedmobile/dependencies forpnpm build,audit:code-quality:nativealso reportsimport(no-cycle)warnings inmobile/src/transportandmobile/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 insrc/rendererpass. The full run had 57 failures in 23 files, none insrc/rendererand none importing a changed module. They are environment failures on this Mac: missingpgincloud/,/private/varvs/varpaths, macOS bash 3.2unbound variable, zsh/PTY startup timeouts, and lock contention in the cross-version harness. I did not re-run them on a cleanmain.pnpm build: every JavaScript step passes (typecheck, CLI, electron-vite, web client, mobile web).build:nativefails locally because the Command Line Tools ship arm64-only Swift compatibility libraries, so thex86_64slice ofnative/notification-status-macoscannot 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:
Summary by the authoring agent:
NumberFieldis the same shared control on every platform.build:mobile-webpasses.terminalFontSize ?? 13). There is no default entry and no migration. An older Orca reading a newer settings file ignores the extra key.resolveEditorBaseFontSizeis 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.computeEditorFontSizeclamps the final size to 8–32. A value outside 10–24 written through the settings file or the CLI still ends inside 8–32.SearchableSettingandNumberField, the house form controls, and sits next to Editor Font Family. All strings are translated.Agent skill upstream boundary
Notes
editor-font-zoom.ts. Whichever PR merges second needs a small rebase.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code