Fix 'UndoRedo' increasing its version on actions that should be merged

This commit is contained in:
Michael Alexsander Silva Dias 2019-03-22 22:06:01 -03:00
parent 6d27226134
commit e63e3875d7
2 changed files with 8 additions and 1 deletions

View file

@ -90,7 +90,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
actions.write[actions.size() - 1].last_tick = ticks; actions.write[actions.size() - 1].last_tick = ticks;
merge_mode = p_mode; merge_mode = p_mode;
merging = true;
} else { } else {
Action new_action; Action new_action;
@ -250,6 +250,11 @@ void UndoRedo::commit_action() {
if (action_level > 0) if (action_level > 0)
return; //still nested return; //still nested
if (merging) {
version--;
merging = false;
}
commiting++; commiting++;
redo(); // perform action redo(); // perform action
commiting--; commiting--;
@ -396,6 +401,7 @@ UndoRedo::UndoRedo() {
action_level = 0; action_level = 0;
current_action = -1; current_action = -1;
merge_mode = MERGE_DISABLE; merge_mode = MERGE_DISABLE;
merging = false;
callback = NULL; callback = NULL;
callback_ud = NULL; callback_ud = NULL;

View file

@ -80,6 +80,7 @@ private:
int current_action; int current_action;
int action_level; int action_level;
MergeMode merge_mode; MergeMode merge_mode;
bool merging;
uint64_t version; uint64_t version;
void _pop_history_tail(); void _pop_history_tail();