Repository navigation
Preserve reading positions across source mode - #218
Merged
Merged
Conversation
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
Switching from WYSIWYG to source mode and then backgrounding the app could replace the reading position with the document end. Resume capture still measured Muya's hidden DOM, whose rectangles were zero-sized, and source edits could pair that stale structure with the textarea's newer Markdown. Capture now preserves the visible WYSIWYG position before the handoff and skips capture while source mode owns the document.
Behavior
Design and responsibility boundaries
App.vueowns the editing-mode decision. Only the resume controller's Markdown getter returnsnullwhile source mode is active; document autosave, share/export, source-mode undo, and caret handoff retain their existing snapshot behavior. The existing nullable getter is sufficient, so this adds no mode framework or new settings.The resume controller rechecks capture-surface availability after asynchronous hash validation. Standing down also cancels the opening-time offer across both layout settling and hash validation, so switching back to WYSIWYG cannot revive a dismissed, still-pending offer. This cancellation lasts only until the next document opening and also honors the existing menu/outline/search handoff callers. Captures already snapshotted before entry may finish under their existing per-document ordering guarantees; canceling restore does not cancel position persistence.
The storage schema, structural block/ratio anchor, manual resume behavior, and strict SHA-256 validation are unchanged. Source-text reading positions are outside this issue's scope. Foreground checkpoint scheduling is tracked separately in #216; this PR's sole fix target is #217.
Verification
pnpm build(includes TypeScript typecheck) passed.git diff --checkpassed.The unfiltered local
pnpm lintalso traverses pre-existing untrackedlocal-archiveevidence and reports errors there; tracked-file validation excludes that workstation-only archive without changing ESLint configuration. These regressions were verified in mobile Chromium, not by terminating an Android process.Closes #217