Commit c5a27e38 authored by Natalie Mona Matthews's avatar Natalie Mona Matthews

make undo snapshot logic more readable

parent 2bf3ae39
Pipeline #29421 failed with stage
in 60 minutes
......@@ -235,19 +235,20 @@ void UndoManager::undoStep(bool saveRedo, bool execute, bool flyingRollback)
{
bool needSnapshot = false;
if (d->redoActions.isEmpty())
if (irreversible)
{
// Undoing from the tip of the list:
// Save the "last", current state for the redo operation
needSnapshot = irreversible;
}
else if (irreversible)
{
// Undoing an irreversible with next redo reversible:
// Here, no snapshot was made in addAction, but we need it now
needSnapshot = dynamic_cast<UndoActionReversible*>(d->redoActions.last());
if (d->redoActions.isEmpty())
{
// Undoing from the tip of the list:
// Save the "last", current state for the redo operation
needSnapshot = true;
}
else
{
// Undoing an irreversible with next redo reversible:
// Here, no snapshot was made in addAction, but we need it now
needSnapshot = dynamic_cast<UndoActionReversible *>(d->redoActions.last());
}
}
if (needSnapshot)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment