diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 2e44138b..2a2b7173 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -258,6 +258,8 @@ static bool handle_lb_action(int i){ if(!file_to_load.empty() && load_scenario(file_to_load, scenario)) { set_pref("LastScenario", file_to_load.string()); restore_editor_state(); + undo_list.clear(); + update_edit_menu(); } else if(!file_to_load.empty()) // If we tried to load but failed, the scenario record is messed up, so boot to start screen. set_up_start_screen(); diff --git a/src/scenedit/scen.appleevents.mm b/src/scenedit/scen.appleevents.mm index 5cd0e386..89e9534e 100644 --- a/src/scenedit/scen.appleevents.mm +++ b/src/scenedit/scen.appleevents.mm @@ -52,6 +52,8 @@ void set_up_apple_events() { std::copy(msg.get(), msg.get() + len, std::inserter(fileName, fileName.begin())); if(load_scenario(fileName, scenario)) { + undo_list.clear(); + update_edit_menu(); set_pref("LastScenario", fileName); restore_editor_state(); change_made = false; diff --git a/src/scenedit/scen.core.cpp b/src/scenedit/scen.core.cpp index 543b8078..a02ada73 100644 --- a/src/scenedit/scen.core.cpp +++ b/src/scenedit/scen.core.cpp @@ -3280,6 +3280,9 @@ bool build_scenario() { if(!edit_make_scen_2(width, height, lg, med, sm, default_town)) return false; + undo_list.clear(); + update_edit_menu(); + scenario = cScenario(); scenario.scen_name = title; scenario.contact_info[0] = author; diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index 4829369f..82562ae9 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -332,6 +332,8 @@ static void process_args(int argc, char* argv[]) { } if(!file.empty()) { if(load_scenario(file, scenario)) { + // On first launch, no need to clear the undo_list + set_pref("LastScenario", file); restore_editor_state(); change_made = false; @@ -516,6 +518,8 @@ void handle_menu_choice(eMenu item_hit) { break; file_to_load = item_hit == eMenu::FILE_OPEN ? nav_get_scenario() : scenario.scen_file; if(!file_to_load.empty() && load_scenario(file_to_load, scenario)) { + undo_list.clear(); + update_edit_menu(); set_pref("LastScenario", file_to_load.string()); restore_editor_state(); change_made = false;