1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Bug2570 residual: Compact should not change last saved state...

... So that if you save, edit, compact, close without saving, then reopen,
you recover the saved state as expected, not the compacted state.

Implications:

Do not push an undo state for compaction.  Discard redo states instead.

Do not purge undo states after the last saved.  The database still needs them.
So we might reclaim less space than before.
This commit is contained in:
Paul Licameli
2020-11-18 15:01:02 -05:00
parent 16b249ab9f
commit 7edbad3cd1
3 changed files with 35 additions and 24 deletions

View File

@@ -321,11 +321,7 @@ void UndoManager::PushState(const TrackList * l,
mayConsolidate = true;
// Abandon redo states
if (saved >= current) {
saved = -1;
}
RemoveStates( current + 1, stack.size() );
AbandonRedo();
// Assume tags was duplicated before any changes.
// Just save a NEW shared_ptr to it.
@@ -343,6 +339,14 @@ void UndoManager::PushState(const TrackList * l,
mProject.QueueEvent( safenew wxCommandEvent{ EVT_UNDO_PUSHED } );
}
void UndoManager::AbandonRedo()
{
if (saved > current) {
saved = -1;
}
RemoveStates( current + 1, stack.size() );
}
void UndoManager::SetStateTo(unsigned int n, const Consumer &consumer)
{
wxASSERT(n < stack.size());
@@ -438,6 +442,11 @@ void UndoManager::StateSaved()
saved = current;
}
int UndoManager::GetSavedState() const
{
return saved;
}
// currently unused
//void UndoManager::Debug()
//{