Add session snapshot feature to preserve unsaved files on exit#1062
Add session snapshot feature to preserve unsaved files on exit#1062chen3feng wants to merge 2 commits into
Conversation
Add a master switch "Enable Session Snapshot" (default on) that automatically persists unsaved and temporary file content to disk so no data is lost when exiting the application. Existing restore settings now control only what gets restored on startup. - Add EnableSessionSnapshot setting (default true) as safety net toggle - Change session restore defaults to true for all three file types - Always save UnsavedFile/TempFile content regardless of restore settings - Filter session loading based on per-type restore preferences - Reduce auto-save interval from 60s to 7s (matching Notepad++) - Trigger session backup on editor tab switches - Fix loadSession to call getSessionManager() first to initialize file types - Remove "experimental" warning from Preferences dialog - Add "Previously open files" restore checkbox to Preferences UI Closes dail8859#81, Closes dail8859#178
|
The Root cause: GitHub recently upgraded This is a pre-existing incompatibility between Qt 6.5 and the new compiler toolchain, not caused by any changes in this PR. Fix options (for a separate PR):
|
Switch to chen3feng/SingleApplication which adds isProcessRunning() check to verify the recorded primary PID is still alive. If the primary instance was force-killed, the new instance takes over instead of exiting as a stale secondary. Also set QT_DEFAULT_MAJOR_VERSION=6 for the updated SingleApplication CMakeLists.
Maybe I'm a bit confused here...but doesn't the application have this capability already? The two issues you referenced are closed. You can restore the previous session along with unsaved files and temp files. What exact set of steps demonstrate the functionality added. |
Summary
This PR implements Notepad++'s session snapshot feature — unsaved "New N" files and modified files are automatically preserved on exit and restored on next launch. No more data loss from accidental closes.
Changes
EnableSessionSnapshotsetting (default on) as a master safety-net toggletrueUnsavedFileandTempFilecontent regardless of restore settings (safety net)Behavior
Files Changed
src/ApplicationSettings.hEnableSessionSnapshotsettingsrc/ApplicationSettings.cpptrue; all restore defaults →truesrc/NotepadNextApplication.cppsrc/SessionManager.cppwillFileGetStoredInSessionunconditional for unsaved/tempsrc/dialogs/PreferencesDialog.cppsrc/dialogs/PreferencesDialog.uicheckBoxSessionSnapshot; restructure restore group boxCloses #81, Closes #178