From e63e3875d7c4eb834bee2bb24c49c540cee0a0fd Mon Sep 17 00:00:00 2001 From: Michael Alexsander Silva Dias Date: Fri, 22 Mar 2019 22:06:01 -0300 Subject: [PATCH] Fix 'UndoRedo' increasing its version on actions that should be merged --- core/undo_redo.cpp | 8 +++++++- core/undo_redo.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index e13164d50f8..69581e4115f 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -90,7 +90,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) { actions.write[actions.size() - 1].last_tick = ticks; merge_mode = p_mode; - + merging = true; } else { Action new_action; @@ -250,6 +250,11 @@ void UndoRedo::commit_action() { if (action_level > 0) return; //still nested + if (merging) { + version--; + merging = false; + } + commiting++; redo(); // perform action commiting--; @@ -396,6 +401,7 @@ UndoRedo::UndoRedo() { action_level = 0; current_action = -1; merge_mode = MERGE_DISABLE; + merging = false; callback = NULL; callback_ud = NULL; diff --git a/core/undo_redo.h b/core/undo_redo.h index b626149ce62..6293e77acc9 100644 --- a/core/undo_redo.h +++ b/core/undo_redo.h @@ -80,6 +80,7 @@ private: int current_action; int action_level; MergeMode merge_mode; + bool merging; uint64_t version; void _pop_history_tail();