BugFix: reload list of recent sessions after any change to history

This commit is contained in:
brunoherbelin
2021-03-30 23:51:06 +02:00
parent 0b845591f9
commit 559a036e6d
2 changed files with 6 additions and 1 deletions

View File

@@ -84,12 +84,14 @@ struct History
bool front_is_valid; bool front_is_valid;
bool load_at_start; bool load_at_start;
bool save_on_exit; bool save_on_exit;
bool changed;
History() { History() {
path = IMGUI_LABEL_RECENT_FILES; path = IMGUI_LABEL_RECENT_FILES;
front_is_valid = false; front_is_valid = false;
load_at_start = false; load_at_start = false;
save_on_exit = false; save_on_exit = false;
changed = false;
} }
void push(const std::string &filename) { void push(const std::string &filename) {
if (filename.empty()) { if (filename.empty()) {
@@ -101,6 +103,7 @@ struct History
if (filenames.size() > MAX_RECENT_HISTORY) if (filenames.size() > MAX_RECENT_HISTORY)
filenames.pop_back(); filenames.pop_back();
front_is_valid = true; front_is_valid = true;
changed = true;
} }
void remove(const std::string &filename) { void remove(const std::string &filename) {
if (filename.empty()) if (filename.empty())
@@ -108,6 +111,7 @@ struct History
if (filenames.front() == filename) if (filenames.front() == filename)
front_is_valid = false; front_is_valid = false;
filenames.remove(filename); filenames.remove(filename);
changed = true;
} }
}; };

View File

@@ -2771,12 +2771,13 @@ void Navigator::RenderMainPannel()
// fill the session list depending on the mode // fill the session list depending on the mode
static std::list<std::string> sessions_list; static std::list<std::string> sessions_list;
// change session list if changed // change session list if changed
if (selection_session_mode_changed) { if (selection_session_mode_changed || Settings::application.recentSessions.changed) {
// selection MODE 0 ; RECENT sessions // selection MODE 0 ; RECENT sessions
if ( selection_session_mode == 0) { if ( selection_session_mode == 0) {
// show list of recent sessions // show list of recent sessions
sessions_list = Settings::application.recentSessions.filenames; sessions_list = Settings::application.recentSessions.filenames;
Settings::application.recentSessions.changed = false;
} }
// selection MODE 1 : LIST FOLDER // selection MODE 1 : LIST FOLDER
else if ( selection_session_mode == 1) { else if ( selection_session_mode == 1) {