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
{{ message }}
Repository navigation
Scroll position resets to end of document on external file change #4151
🪲 pri/majorBugs will affect your normal use of Mark Text, causing you unwilling or unable to continue using MT🐛 bugSomething isn't working🔭 area/editor
When a file is modified by an external editor (e.g. VS Code, terminal), MarkText reloads the content but the scroll position jumps to the end of the document and the cursor moves to the last line. This is disruptive when working with long documents.
Can you reproduce the issue?
Steps to reproduce
Open a long markdown file (200+ headings) in MarkText
Scroll to the middle of the document (e.g. around section 100)
Without closing MarkText, modify the file externally:
echo"# Added externally">> yourfile.md
Switch back to MarkText
Expected behavior:
The scroll position stays at the same location (section 100 area).
Actual behavior:
The scroll position jumps to the end of the document and the cursor moves to the last line. This happens in both WYSIWYG mode and source code mode.
In src/renderer/store/editor.js, the LISTEN_FOR_FILE_CHANGE mutation emits file-changed with renderCursor: true, which triggers scrollToCursor() after reloading content. Additionally, importMarkdown.js defaults the cursor to getLastBlock() (end of document) when no cursor info is available, causing the scroll to jump to the bottom.
🪲 pri/majorBugs will affect your normal use of Mark Text, causing you unwilling or unable to continue using MT🐛 bugSomething isn't working🔭 area/editor
Activity
fix: marktext#4151 preserve scroll position on external file change
fix: marktext#4151 preserve scroll position on external file change (m…
fix: marktext#4151 preserve scroll position on external file change (m…