Repository navigation
fix(desktop): prevent CodeMirror line tree corruption - #4930
Merged
Merged
Conversation
niyo-oyin
added a commit
to niyo-oyin/marktext-ja
that referenced
this pull request
Jul 29, 2026
- PR marktext#4946 (includes its base PR marktext#4942): removes the quadratic costs that froze large documents and mounts them progressively — a 2.1 MB document goes from an indefinite freeze to interactive in seconds. Applied verbatim; upstream review addressed 19 findings with 31 regression tests, all passing here. - PR marktext#4931 (marktext#4926): deleting at an offset inside a surrogate pair left a lone surrogate that crashed text-unicode ("Invalid offset - splits unicode bytes"). The content.ts hunk conflicted with our Phase 1 isComposed guards and was integrated by hand; the new cursor snap additionally runs only when no IME composition is open, since moving the DOM selection mid-composition would detach the IME anchor. - PR marktext#4913 (marktext#4899): Shift+Tab outdent with trailing sibling blocks corrupted the state tree (paragraphs appended directly into a list), crashing the next composed op. muya hunks only — the PR's legacy muyajs hunks target the removed engine. - PR marktext#4911 skipped: the equivalent detached-block guard already exists in @muyajs/core's language selector (marktext#4654), verified in source. - PR marktext#4930 (marktext#4921): CodeMirror instance wrapped in a Vue proxy broke source-code mode; markRaw fix applied cleanly. muya suite 1515/1515, tsc/eslint/madge clean. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ef4yFuXFbyKNTazkwUtygY
niyo-oyin
added a commit
to niyo-oyin/marktext-ja
that referenced
this pull request
Jul 29, 2026
- PR marktext#4946 (includes its base PR marktext#4942): removes the quadratic costs that froze large documents and mounts them progressively — a 2.1 MB document goes from an indefinite freeze to interactive in seconds. Applied verbatim; upstream review addressed 19 findings with 31 regression tests, all passing here. - PR marktext#4931 (marktext#4926): deleting at an offset inside a surrogate pair left a lone surrogate that crashed text-unicode ("Invalid offset - splits unicode bytes"). The content.ts hunk conflicted with our Phase 1 isComposed guards and was integrated by hand; the new cursor snap additionally runs only when no IME composition is open, since moving the DOM selection mid-composition would detach the IME anchor. - PR marktext#4913 (marktext#4899): Shift+Tab outdent with trailing sibling blocks corrupted the state tree (paragraphs appended directly into a list), crashing the next composed op. muya hunks only — the PR's legacy muyajs hunks target the removed engine. - PR marktext#4911 skipped: the equivalent detached-block guard already exists in @muyajs/core's language selector (marktext#4654), verified in source. - PR marktext#4930 (marktext#4921): CodeMirror instance wrapped in a Vue proxy broke source-code mode; markRaw fix applied cleanly. muya suite 1515/1515, tsc/eslint/madge clean.
Jocs
approved these changes
Sep 4, 2026
This was referenced Sep 10, 2026
Closed
Closed
Closed
Closed
Closed
Closed
Closed
Closed
Closed
Closed
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.
Closes #4921
Closes #4456
Summary
Prevents Vue from deep-proxying the stateful CodeMirror instance used by Source Code mode. CodeMirror's document tree relies on strict object identity between documents, leaf chunks, and lines; proxying the instance can break those parent relationships and surface as the reported
lineNo/chunkSizerenderer crash.The instance is now wrapped with Vue's
markRaw, matching the existing Muya integration. A focused Electron e2e regression covers the real file-update path followed by the reported Bash-script paste, verifies the CodeMirror line tree remains consistent, confirms the paste changes the document, and checks for renderer errors.Type of change
Test plan
The following checks passed: desktop build, TypeScript typecheck, targeted ESLint, and the related Source Code e2e suite (18 passed, 1 existing skip).
Notes for reviewers [optional]
The final regression spec was verified red/green against both implementations: without
markRaw, the paste was applied butlineTreeIntactwasfalse; withmarkRaw, the same test passes. Both linked issues report the same CodeMirrorlineNo/chunkSizestack. #4921 supplies the Bash paste case; #4456 has no reproduction steps but hits the same remaining CodeMirror-backed Source Code path.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.