What happened?
Two related issues when switching between Editor (⌘1) and Preview (⌘2):
Editor → Preview:
Scrolling to the middle in Editor opens Preview at the top.
Preview → Editor:
Scrolling in Preview and switching back makes the Editor jump to the bottom.
Expected:
Scroll position should be preserved in both directions (as intended by ScrollBridge in PositionSync.swift).
Root cause:
computeScrollFraction uses:
clipView.bounds.origin.y / maxScroll
With flipped NSTextView coordinates, this becomes negative when scrolled:
ScrollBridge.set[...] = -0.5863
Preview assumes a 0–1 positive fraction and calls:
scrollTo(0, fraction × maxScroll)
So:
Negative fraction → clamped to top (Editor → Preview)
Positive fraction from preview → misapplied by editor → clamps to bottom (Preview → Editor)
This is a coordinate convention mismatch between editor and preview.
Steps to reproduce
Symptom 1 (Editor → Preview):
Open any .md file long enough to need scrolling.
In Editor mode (⌘1), scroll to roughly the middle.
Press ⌘2 to switch to Preview.
Preview opens at the top instead of the middle.
Symptom 2 (Preview → Editor):
From the previous state, scroll the preview to any position.
Press ⌘1 to switch back to Editor.
Editor jumps to the bottom instead of matching the preview position.
App version
1.13.0
macOS version
26.4
Screenshots
Screen.Recording.2026-04-10.at.12.08.17.AM.mov
Problematic file
No response
What happened?
Two related issues when switching between Editor (⌘1) and Preview (⌘2):
Editor → Preview:
Scrolling to the middle in Editor opens Preview at the top.
Preview → Editor:
Scrolling in Preview and switching back makes the Editor jump to the bottom.
Expected:
Scroll position should be preserved in both directions (as intended by
ScrollBridgeinPositionSync.swift).Root cause:
computeScrollFractionuses:With flipped
NSTextViewcoordinates, this becomes negative when scrolled:Preview assumes a 0–1 positive fraction and calls:
So:
This is a coordinate convention mismatch between editor and preview.
Steps to reproduce
Symptom 1 (Editor → Preview):
Symptom 2 (Preview → Editor):
App version
1.13.0
macOS version
26.4
Screenshots
Screen.Recording.2026-04-10.at.12.08.17.AM.mov
Problematic file
No response