mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 08:30:06 +02:00
Don't push vacuous undo items...
... Vacuous pushes should not happen yet, but may happen after the machinery for pending track changes is added and used. This will only detect the case of one new recording track being modified. It will not detect it if that track is modified, but other tracks exist that are not modified.
This commit is contained in:
parent
539e870302
commit
43776f5263
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user