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
[Bug] Unsaved changes are discarded without warning when closing an edited Markdown file #5596
When I edit an existing Markdown file and then close the document or MarkText without saving it manually, the changes are discarded without any warning.
I would expect MarkText to detect that the document contains unsaved changes and show a confirmation dialog asking whether I want to save, discard, or cancel closing the document.
This is particularly risky because there is no indication that the edits will be lost.
Additional information
The issue is reproducible with ordinary Markdown files and does not seem to depend on any specific Markdown content.
From a user perspective, silently discarding edits is a data-loss risk. Even with Auto Save disabled, the application should warn before closing a modified document.
Related to #4455 that should have been fixed, but I noticed it today again.
Steps to Reproduce
Open an existing .md file in MarkText. Auto Save: disabled.
Make any change to the document.
Do not save the file manually.
Close the document or close MarkText.
Open the file again.
Expected Behavior
MarkText should detect the unsaved changes and display a confirmation dialog, for example:
Save
Don't Save
Cancel
Actual Behavior
The document closes immediately without any warning and all changes are lost.
The issue #4455 seems to be fixed for 0.20.0 (worth checking against the latest RC build).
BTW the editor indicates the modified state of a document with a green dot next to the filename (in the window caption):
So if the dot doesn't appear after the content modification, the editor may discard the changes on close.
@Anton-V-K When I tried to check for updates, the app said my version is up to date. The 0.20.0 is pre-release. So I guess I need to wait for the official release then...
pre-0.20.0 versions could ignore certain changes in text formatting, thus leading to unsaved changes loss.
I guess, a specific scenario is needed.
I've quickly tested the recent version 0.20.0 (on Windows 11), and it is quite good in detecting changes, even with Undo-Redo.
Tested against current develop source, commit 99c6039 (0.22.0-dev), on macOS with a fresh user-data directory and Auto Save explicitly disabled. Built the app from source and exercised the real Electron main/renderer close flow using Playwright.
Could not reproduce the reported silent loss of edits:
Visual editor: closing an edited existing Markdown tab requests Save / Don’t Save / Cancel.
Visual editor: closing the window with startup action set to blank requests the same confirmation.
Source mode: both tab close and window close request the same confirmation.
In all four cases, returning Cancel keeps the modified tab and its edits open; the file on disk remains unchanged.
With the default “restore all” startup action, window close intentionally skips the save prompt. Closing and restarting with the same user-data directory restores the unsaved edits and the modified indicator; the original file on disk remains unchanged.
The four confirmation cases and the close/restart restoration case passed. This verification covers the current development version on macOS, not the older reported releases or a native Windows/Linux run.
Closing as unable to reproduce on current develop. If this persists on a newer build, please reopen with the exact version, startup action, editing mode, whether you close a tab or the window, and a minimal sequence of edits (including whether the modified indicator appears).
Hi! I'm experiencing this bug too with a different version.
OS: Windows 11 Version: 0.23.0 Bug details:
When closing through the windows close button, unsaved changes are discarded without warning. It happens even though the file's tab shows the dot marking the file as "edited".
Important note: when closing the file through the close button in the tab or by using the ctrl+W shortcut, the warning modal with the options "save/don't save/cancel" is shown correctly.
@Jocs I wanted to reopen the issues but seems like I do not have the permissions (sorry, first time collaborating in github, so I hope I'm doing everything alright)
@Jocs Yes, I can reproduce it. But I think I found the culprit as I've been testing out different preferences settings. I'll describe two different use cases step by step.
Use case 1
Settings, under "Startup Files/Folders" the option "Open blank page" is selected
Run MarkText
Open a file
Edit the file
Press on window's [X] button
A modal is shown with the "save/don't save/cancel" buttons.
Works as intended.
Use case 2
Settings, under "Startup Files/Folders" the option "Restore all opened files and folders" is selected.
Run MarkText
Open a file
Edit the file
Press on window's [X] button
MarkText closes. No modal is shown.
(optional) Open the same file with notepad: the edits are not saved.
Run MarkText again
The file is shown with the edits, but they are have not been saved to the file itself yet.
I think the behaviour in the use case n. 2 is the one making things unclear.
At least to me, when I close a file, I would expect it to trigger the modal, no matter the fact that next time I run MarkText that same file will be opened with the (unsaved) edits available. Maybe that's the same problem other users were experiencing and couldn't pinpoint.
Thank you @lucielavickova-tesena and everyone who reported this and shared reproduction details. In particular, @mpasquato's comparison of "Open blank page" versus "Restore all opened files and folders", and the distinction between closing a tab and closing the window, made the triggering condition clear.
The window-close path was deliberately skipping the save confirmation when restoreAll was selected, even though the document was correctly marked as modified. Retaining edits in the recovery cache does not make it clear to users that the original file has not been saved.
I've opened #5912 to make the behavior consistent: closing a window or quitting with unsaved changes will request Save / Don't Save / Cancel, regardless of the startup setting, including for untitled drafts. Saving must succeed before closing; choosing Don't Save removes those edits from the recovery snapshot; Cancel keeps the window and its edits open.
The change was developed with failing regression tests first and verified in the real application on macOS / Electron 45. All 1,469 unit tests and 38 selected Electron E2E tests passed, including restart checks, canceled/failed saves, source-mode quitting, and crash recovery.
Thanks again for the concrete steps and for following up across versions. They helped turn this into a reproducible, test-covered fix.
Activity
Anton-V-K commentedon Sep 30, 2026
The issue #4455 seems to be fixed for
0.20.0(worth checking against the latest RC build).BTW the editor indicates the modified state of a document with a green dot next to the filename (in the window caption):
So if the dot doesn't appear after the content modification, the editor may discard the changes on close.
lucielavickova-tesena commentedon Oct 1, 2026
@Anton-V-K When I tried to check for updates, the app said my version is up to date. The 0.20.0 is pre-release. So I guess I need to wait for the official release then...
Angelo-Mascaro commentedon Oct 4, 2026
On windows 11 I have 0.20.0 and the bug is still there: I close and I lose the modifications.
Anton-V-K commentedon Oct 5, 2026
pre-0.20.0 versions could ignore certain changes in text formatting, thus leading to unsaved changes loss.
I guess, a specific scenario is needed.
I've quickly tested the recent version 0.20.0 (on Windows 11), and it is quite good in detecting changes, even with Undo-Redo.
artofit commentedon Oct 13, 2026
I confirm the bug in v0.21.2 and was about to report it.
It's not windows specific, I have it on Linux.
Additionnally, would consider to add in the title bar the number of minutes since last save.
Thanks
Jocs commentedon Oct 16, 2026
Tested against current develop source, commit 99c6039 (0.22.0-dev), on macOS with a fresh user-data directory and Auto Save explicitly disabled. Built the app from source and exercised the real Electron main/renderer close flow using Playwright.
Could not reproduce the reported silent loss of edits:
The four confirmation cases and the close/restart restoration case passed. This verification covers the current development version on macOS, not the older reported releases or a native Windows/Linux run.
Closing as unable to reproduce on current develop. If this persists on a newer build, please reopen with the exact version, startup action, editing mode, whether you close a tab or the window, and a minimal sequence of edits (including whether the modified indicator appears).
mpasquato commentedon Oct 23, 2026
Hi! I'm experiencing this bug too with a different version.
OS: Windows 11
Version: 0.23.0
Bug details:
When closing through the windows close button, unsaved changes are discarded without warning. It happens even though the file's tab shows the dot marking the file as "edited".
Important note: when closing the file through the close button in the tab or by using the ctrl+W shortcut, the warning modal with the options "save/don't save/cancel" is shown correctly.
@Jocs I wanted to reopen the issues but seems like I do not have the permissions (sorry, first time collaborating in github, so I hope I'm doing everything alright)
Jocs commentedon Oct 23, 2026
@mpasquato Could you describe your problem in more detail? Or are you able to reproduce the issue consistently?
mpasquato commentedon Oct 23, 2026
@Jocs Yes, I can reproduce it. But I think I found the culprit as I've been testing out different preferences settings. I'll describe two different use cases step by step.
Use case 1
Settings, under "Startup Files/Folders" the option "Open blank page" is selected
Works as intended.
Use case 2
Settings, under "Startup Files/Folders" the option "Restore all opened files and folders" is selected.
I think the behaviour in the use case n. 2 is the one making things unclear.
At least to me, when I close a file, I would expect it to trigger the modal, no matter the fact that next time I run MarkText that same file will be opened with the (unsaved) edits available. Maybe that's the same problem other users were experiencing and couldn't pinpoint.
Tikitronics commentedon Oct 27, 2026
Same behaviour here. Really frustrating, I lost data twice since I rely on a program asking me if I want to save on exit.
Jocs commentedon Oct 27, 2026
Thank you @lucielavickova-tesena and everyone who reported this and shared reproduction details. In particular, @mpasquato's comparison of "Open blank page" versus "Restore all opened files and folders", and the distinction between closing a tab and closing the window, made the triggering condition clear.
The window-close path was deliberately skipping the save confirmation when
restoreAllwas selected, even though the document was correctly marked as modified. Retaining edits in the recovery cache does not make it clear to users that the original file has not been saved.I've opened #5912 to make the behavior consistent: closing a window or quitting with unsaved changes will request Save / Don't Save / Cancel, regardless of the startup setting, including for untitled drafts. Saving must succeed before closing; choosing Don't Save removes those edits from the recovery snapshot; Cancel keeps the window and its edits open.
The change was developed with failing regression tests first and verified in the real application on macOS / Electron 45. All 1,469 unit tests and 38 selected Electron E2E tests passed, including restart checks, canceled/failed saves, source-mode quitting, and crash recovery.
Thanks again for the concrete steps and for following up across versions. They helped turn this into a reproducible, test-covered fix.
fix: #5596 confirm unsaved changes regardless of startup action (#5912)