diff --git a/src/UndoManager.cpp b/src/UndoManager.cpp index 2933270ee..40f5467fa 100644 --- a/src/UndoManager.cpp +++ b/src/UndoManager.cpp @@ -272,13 +272,6 @@ void UndoManager::PushState(const TrackList * l, return; } - mayConsolidate = true; - - i = current + 1; - while (i < stack.size()) { - RemoveStateAt(i); - } - auto tracksCopy = TrackList::Create(); for (auto t : *l) { if ( t->GetId() == TrackId{} ) @@ -287,6 +280,19 @@ void UndoManager::PushState(const TrackList * l, tracksCopy->Add(t->Duplicate()); } + // Quit with no effects if the change looks vacuous + // (Don't examine track contents to decide vacuity) + if (current >= 0 && + tags == stack[current]->state.tags && tracksCopy->empty()) + return; + + mayConsolidate = true; + + i = current + 1; + while (i < stack.size()) { + RemoveStateAt(i); + } + // Assume tags was duplicted before any changes. // Just save a NEW shared_ptr to it. stack.push_back(