feat: implement multi window session hot exit restore with auto save/backup capabilities#497
feat: implement multi window session hot exit restore with auto save/backup capabilities#497FreddyFunk wants to merge 1 commit intopop-os:masterfrom
Conversation
- Update Cargo.toml to use Lcstyle/cosmic-text fork with rope-buffer feature - Add patch section to redirect all cosmic-text dependencies to fork - Add comprehensive FORK_BUILD_INSTRUCTIONS.md documenting: - All patches required (cosmic-text, onig) - Features included (PR pop-os#497, pop-os#479, large file fixes) - Troubleshooting common build issues - Include fresh Cargo.lock with correct dependency resolution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Integrates feature/rope-buffer-integration branch which adds: - RopeBuffer for efficient viewing of very large files (>1MB) - Scrollbar improvements with proper thumb sizing for large files - Line number offset support for windowed buffer display - ScrollChanged message handler for incremental window refresh Combined with existing features: - Session restore + auto-save (PR pop-os#497) - Save As duplicate tab fix (PR pop-os#479) - Large file memory fix (Issue pop-os#457) - Skip content hash for large files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
I implemented this in my fork but then changed the behavior so it doesn't bother me.. Just works, thanks this is a good feature. |
garrettjwilke
left a comment
There was a problem hiding this comment.
works as expected.
opened new edit window -> made changes, did not save -> reboot -> loaded unsaved editor windows
attempted with multiple tabs as well, also works
checked against an existing file but not saved -> also works
Checklist:
Basic operations
- Type three lines of text (no trailing newline).
- Copy the last two lines.
- Paste at the end of the third line (file should now have four lines).
- Ctrl-Z to undo the paste.
- Press Enter to add a trailing newline.
- Paste again (file should now have five lines).
- Ctrl-Z to undo the paste.
- Ctrl-Shift-Z to redo the paste.
- Save the file.
- Ctrl-F and search for something that has a match.
- Press Esc twice to exit the Find dialog.
- Press Ctrl-X to cut the selected search result.
- Paste the cut text on a new line (file should now have six lines).
- Re-save the file.
- Narrow the window until the lines start wrapping (make a line longer if necessary to observe line wrapping).
- Turn word wrapping off.
- Scroll right to the end of the document, then left to the beginning again.
- Click and drag to select some text past the horizontal edge of the window.
- Close the file, open COSMIC Edit again, and open the file via the recents list.
- Close the file again, open COSMIC Edit again, and open the file via the Open dialog.
- Turn word wrapping back on.
Settings
- Open View -> Settings.
- All Appearance settings work.
- Vim bindings work.
Projects & Git Management
- Clone the cosmic-edit Git repo and open its directory as a project.
- Edit -> Find in project... works.
- Make a change in a file.
- File -> Git management shows the change and staging it works.
- Make another change while Git management's open; it updates to show the new change.
|
great news to here that the tests are successful :) is there anything else I can do? |
…backup capabilities
e50cced to
ce2afa1
Compare
|
I rebased to the latest master and resolved the conflicts. Yes, it might be a good idea to rename those settings. Do you have any suggestions? Regarding the |
I second this. Might be a good idea to extend the functionality.
I agree, it makes sense to make the setting more general. I wonder if "Startup and recovery" might be more specific than "App settings". I'd also suggest using "Automatically save files" as the main label and dropping the caption. I omitted period of inactivity after thinking more about it. The reason is that this is essentially what's going to happen. We just need to make sure that files are also saved at the app closing. That probably won't impact new documents that haven't been named yet as we'd still need to ask if people would want to save changes and prompt to choose the location. There might be a more elegant way to deal with that last case but that could be a future improvement. |
|
This PR will require a careful code review, so I have not been able to allocate time to it yet. It is still a desired feature. |

I really like COSMIC Edit for quick note taking during development, but when tinkering with kernel drivers, desktop environments and GPU drivers, I sometimes have to hard reset my machine and then lose those notes. This annoyed me so I tried to come up with a fully featured, full multi window session recovery that is as resilient as possible.
Summary
Implements hot exit functionality for COSMIC Edit, enabling session restoration and automatic backup of unsaved work across crashes and unexpected closures.
Features
hot_exit_max_auto_restore)Configuration Options
New settings added to App Settings:
reopen_on_start: Reopen projects and tabs on start (default: true)auto_save: Automatically save files after inactivity (default: false)auto_save_interval_secs: Interval between auto-saves in seconds (default: 2)hot_exit_max_auto_restore: Maximum sessions to auto-restore without promptingWarning
Session restoration and auto save / auto backup capabilities are non-trivial with many edge case. I tried to make to cover every edge case I could think of, but I still recommend thorough testing.
supersedes #146
closes #94
closes #134
closes #150