Skip to content

Commit

Permalink
Remove old tabs on session load
Browse files Browse the repository at this point in the history
  • Loading branch information
SimTheVoid authored and SimLV committed May 6, 2024
1 parent 9184f1d commit bb15f67
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
22 changes: 0 additions & 22 deletions doc/TODO.md

This file was deleted.

13 changes: 13 additions & 0 deletions src/NotepadNext/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ ScintillaNext *SessionManager::loadSession(MainWindow *window, QSettings &settin
const int currentEditorIndex = settings.value("CurrentEditorIndex").toInt();
const int size = settings.beginReadArray("OpenedFiles");

for (auto &editor : window->editors()) {
if (editor->isFile()) {
if (editor->isSavedToDisk()) {
editor->close();
}
}
else {
if (!editor->modify()) {
editor->close();
}
}
}

// NOTE: In theory the fileTypes should determine what is loaded, however if the session fileTypes
// change from the last time it was saved then it means the settings were manually altered outside of the app,
// which is non-standard behavior, so just load anything in the file
Expand Down

0 comments on commit bb15f67

Please sign in to comment.