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
We currently have four open zoom PRs that overlap on the same menu items and shortcuts but split into two half-features. Neither half is complete on its own, and they collide if merged together. This issue proposes consolidating them into a single "document zoom" feature: one zoom level, one key pair (⌘+ / ⌘− / ⌘0), scaling both the editor and the preview together — which is exactly what #335 originally asked for.
Implementation note: the synthesis described here is maintainer-led. #395 and #442 are starting points to build on — no further work is expected from their authors, and the Format-shortcut relocation below is part of our scope, not theirs.
Key finding: the "both panes" PRs don't actually zoom the preview
The three per-document PRs (#337, #395, #411) route preview scaling through MPDocument's existing scaleWebview, whose body is dead code:
CGFloat scale = [selfpreviewScale]; // computed…
#if0
// Sadly, this doesn't work correctly.
// It looks fine, but selections are offset relative to the mouse cursor.
... // …the code that applies `scale` is #if 0'd out
#endif
That #if 0 predates all of these PRs — MacDown disabled view-transform preview scaling long ago because of a selection-offset bug. So those three PRs compute a preview scale factor and throw it away: in practice they only zoom the editor font.
#442 is the only PR that actually zooms the preview, because it sidesteps that broken path entirely and uses WebKit's setPageSizeMultiplier: (true page zoom — text, images, and layout), which doesn't have the selection-offset problem.
The missing piece that makes "one key pair, both panes" finally work is replacing the dead #if 0 transform with #442's setPageSizeMultiplier: approach.
Proposed unified design
One feature, built by synthesizing the working halves rather than picking a single PR:
One source of truth — a single, persisted zoom level (its own preference, never the editor base font), applied to every document.
Preview → setPageSizeMultiplier: (from Add zoom controls for the preview pane #442), re-applied on each mainFrame finished-load (WebKit resets the multiplier on every load).
One key pair: ⌘+ / ⌘− / ⌘0 (Zoom In / Zoom Out / Actual Size). Take the native shortcuts and relocate the colliding Format shortcuts — Highlight (⌘=), Strikethrough (⌘−), Paragraph (⌘0) — the way Add transient document zoom shortcuts #411 does, rather than retreating to ⌘⇧ variants. For the headline feature the standard keys are worth it.
Add zoom controls for the preview pane #442 — the working preview mechanism (setPageSizeMultiplier: + re-apply on load), the toolbar preset dropdown, and the preference/migration plumbing.
Add transient document zoom shortcuts #411 — the snap/step polish: multiplicative stepping and fontWithDescriptor: (preserves font traits) instead of fontWithName:size:.
Resolved — zoom is a persisted single preference, applied to every window (Safari-style), backed by a dedicated zoom-level preference + migration (the #442 plumbing). It is deliberately not the transient per-document model, and it is not the editor base font, so it never clobbers the user's saved font (which was the original objection in #335). The level is restored on launch.
Format-shortcut relocation
⌘+ / ⌘− / ⌘0 currently collide with Format menu items — Highlight (⌘=), Strikethrough (⌘−), and Paragraph (⌘0). The headline zoom shortcuts win these keys; the Format actions get reassigned (or moved to ⌘⇧ variants). This is in scope for the unified feature itself and is maintainer-side work — not a request to any PR author.
Test plan
Editor: font, tab stops, and paragraph style all scale; zoom survives an editor-font preference change; no highlighter re-parse per step (perf).
Preview: setPageSizeMultiplier: applied and re-applied after each render/reload; images and text scale together.
Bounds: clamp at 50%–300% (or chosen preset range); menu items validate at the limits; Actual Size resets.
Shortcuts: ⌘+/⌘−/⌘0 reach zoom; relocated Format shortcuts (Highlight/Strikethrough/Paragraph) still function at their new bindings.
Persistence: migration default (100%), value restored on launch, shared across open windows.
Related to Add Cmd+/Cmd- zoom keyboard shortcuts #335 — the original request ("zoom the editor and preview panes together"); this issue is the consolidated implementation plan for it.
Summary
We currently have four open zoom PRs that overlap on the same menu items and shortcuts but split into two half-features. Neither half is complete on its own, and they collide if merged together. This issue proposes consolidating them into a single "document zoom" feature: one zoom level, one key pair (⌘+ / ⌘− / ⌘0), scaling both the editor and the preview together — which is exactly what #335 originally asked for.
Background: what the four PRs actually do
The PRs fall into two camps:
Key finding: the "both panes" PRs don't actually zoom the preview
The three per-document PRs (#337, #395, #411) route preview scaling through
MPDocument's existingscaleWebview, whose body is dead code:That
#if 0predates all of these PRs — MacDown disabled view-transform preview scaling long ago because of a selection-offset bug. So those three PRs compute a preview scale factor and throw it away: in practice they only zoom the editor font.#442 is the only PR that actually zooms the preview, because it sidesteps that broken path entirely and uses WebKit's
setPageSizeMultiplier:(true page zoom — text, images, and layout), which doesn't have the selection-offset problem.So the real split is:
The missing piece that makes "one key pair, both panes" finally work is replacing the dead
#if 0transform with #442'ssetPageSizeMultiplier:approach.Proposed unified design
One feature, built by synthesizing the working halves rather than picking a single PR:
zoomedEditorFont+applyEditorFontAndParagraphStyle(from Address issue #335: Add zoom keyboard shortcuts (Cmd+Shift+=/Cmd+Shift+-) #395). This keeps tab stops aligned at the zoomed size, survives editor-font preference changes, and avoids a full highlighter re-parse on every zoom step.setPageSizeMultiplier:(from Add zoom controls for the preview pane #442), re-applied on eachmainFramefinished-load (WebKit resets the multiplier on every load).previewZoomRelativeToBaseFontSizeworking independently, per Add Cmd+/Cmd- zoom keyboard shortcuts #335.What to take from each PR
applyEditorFontAndParagraphStyle,zoomedEditorFont), the lightweight apply path (no re-highlight), conflict-free menu validation, and its test suite (MPZoomTests.m, ~21 tests).setPageSizeMultiplier:+ re-apply on load), the toolbar preset dropdown, and the preference/migration plumbing.fontWithDescriptor:(preserves font traits) instead offontWithName:size:.Decision: persisted single preference ✅
Resolved — zoom is a persisted single preference, applied to every window (Safari-style), backed by a dedicated zoom-level preference + migration (the #442 plumbing). It is deliberately not the transient per-document model, and it is not the editor base font, so it never clobbers the user's saved font (which was the original objection in #335). The level is restored on launch.
Format-shortcut relocation
⌘+ / ⌘− / ⌘0 currently collide with Format menu items — Highlight (⌘=), Strikethrough (⌘−), and Paragraph (⌘0). The headline zoom shortcuts win these keys; the Format actions get reassigned (or moved to ⌘⇧ variants). This is in scope for the unified feature itself and is maintainer-side work — not a request to any PR author.
Test plan
setPageSizeMultiplier:applied and re-applied after each render/reload; images and text scale together.MPZoomTests.m(Address issue #335: Add zoom keyboard shortcuts (Cmd+Shift+=/Cmd+Shift+-) #395) andMPPreviewZoomTests.m(Add zoom controls for the preview pane #442).Related issues and PRs