fix: replace the last-open-files list when a window closes (#686) - #691
Merged
Merged
Conversation
SaveLastOpenFilesList only ever appended, and the list was cleared in one branch of LoadStartupFiles. Startup with command-line files, or with "Open last files" turned off, skipped that clear, so every close appended the current tabs to a stale list: it grew without bound and restored tabs closed sessions ago. The closing window now owns the list. The first window to close replaces it, dropping entries from earlier sessions; windows closing after it append, so a multi-window session is still restored as a whole. The clear in LoadStartupFiles is gone, which also means a crash mid-session no longer wipes the set of files to restore. Tests cover the replace, the append for a second closing window, the clear when only temp files are open, and that loading keeps the list.
Contributor
Collaborator
Author
interesting, should only wipe it if no files are open, probably a bug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #686.
SaveLastOpenFilesList only ever appended, while the clear lived in one branch of LoadStartupFiles. Starting with command-line files, or with Open last files off, skipped that clear — so each close appended the current tabs to a stale list, which grew without bound and restored tabs closed sessions ago.
The closing window now owns the list. The first window to close replaces it; windows closing after it append, so a multi-window session is still restored as a whole rather than only the last window to close. The clear in LoadStartupFiles is removed, so a crash mid-session no longer wipes the set of files to restore.
Behaviour notes:
Tests: replace-on-first-close, append-on-second-window, clear when only temp files are open, and load-keeps-the-list.