fix(editor): stabilize math preview scrolling - #657
Merged
Conversation
Keep full-document math decorations stable during viewport-only updates while still refreshing for parser progress and editor state changes. Refs #654
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace multiline source with state-backed block decorations so CodeMirror owns the complete visual height. Cache rendered formulas across reveal-only updates and estimate offscreen block height from the source footprint. Refs #654
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
.cm-linedisplay: nonelayout workaroundWhy
The issue attachment has roughly 929 math ranges. Viewport updates previously rescanned and rerendered all of them, while multiline formulas hid individual editor lines outside CodeMirror’s block height model. Together these could make large scroll jumps expensive and leave WebKit with stale document geometry.
Moving block decorations into editor state fixed the height model, but the first CI run also exposed a focus-sync transaction racing controlled Chinese IME input. Focus changes are now applied synchronously before composition, deferred while composition owns the editable DOM, and reconciled after composition ends.
Validation
pnpm --filter @markra/app test— 1,494 tests passed, including the controlled IME/image regressionpnpm --filter @markra/editor test— 450 tests passedpnpm --filter @markra/app buildandtypecheck:test— passedpnpm --filter @markra/editor buildandtypecheck:test— passedpnpm --filter @markra/desktop build— passed, including vendor chunk verification160079pxheight at 150ms/850ms, and no error toastRisk
Refs #654