Repository navigation
feat: add auto-reload preference for external file changes (#3652) - #5458
muchstarlight wants to merge 1 commit into
Conversation
新增 autoReload 选项(默认关闭)。标签页无未保存修改时,外部对文件的 写入会静默重载,不再弹出确认。未保存时仍确认,避免覆盖 MarkText 里的编辑。 不复用 autoSave:自动保存会把缓冲区写回磁盘,外编场景下可能覆盖对方刚写的内容。
|
Thanks for taking this on, and sorry for the slow reply. Your diagnosis is the right one — in particular, calling out that auto-reload must not be tied to Where I ended up differing is on the preference. With
Neither asks. A tab with no local edits discards nothing when it reloads, and our So I went with the same behavior as the default, gated on Your test cases carried over almost as-is; I kept your four scenarios and changed the reload test to assert the real outcome ( Closing this in favor of #5479 — not because the work was wrong, but because the default moved. Please do keep them coming, and thank you for the careful write-up. One thing #5479 deliberately does not touch, if you are looking for a follow-up: the dirty-tab conflict is still a bare Yes/No prompt that throws away local edits on Yes. VS Code offers |
Closes #3652
Summary
Adds an opt-in Auto Reload preference so MarkText can silently reload a file when it changes on disk (external editor / AI tools / split-window preview).
Silent reload only runs when the tab has no unsaved edits. If the buffer is dirty, the existing “reload?” confirmation is kept so local work is not discarded.
This is intentionally not tied to Auto Save: Auto Save writes MarkText’s buffer back to disk and can overwrite the other editor. It is also not a read-only “Reading Mode”; the request is auto-reload while still being able to view/edit.
Default is
false, so existing behavior is unchanged. The previous Auto Save silent-reload path is preserved.Type of change
Test plan
Unit tests in
file-change-content-check.spec.tscover:loadChangeManual: Preferences → General → Auto Reload on, Auto Save off; edit the open file in another editor and save; MarkText updates without the reload dialog. Unsaved local edits still prompt.
Notes for reviewers
autoReload(schema,preference.json, Pinia, General pane, all 11 locales,PREFERENCES.md)mt::update-fileis extendedlocale-validation); happy to drop them toen.jsonif you’d rather route translations separately