Changed how performing undo interacts with volatile modes (it will now actually perform the undo instead of just canceling the volatile mode)

This commit is contained in:
biwa 2020-06-13 15:56:16 +02:00 committed by spherallic
parent 7d180e5cae
commit 4b0dce43ed
2 changed files with 121 additions and 115 deletions

View file

@ -608,10 +608,13 @@ namespace CodeImp.DoomBuilder.Editing
// Call UndoBegin event
if(General.Editing.Mode.OnUndoBegin())
{
// Cancel volatile mode, if any
// This returns false when mode was not volatile
if(!General.Editing.CancelVolatileMode())
{
// biwa. Previously being in a volatile mode simply switch back the the previous
// stable mode without actually performing the undo. This causes problems when the
// volatile mode create undo snapshots. EditSelectionMode does this, and removing
// it's undo snapshot only works because the mode's OnCancel is called twice.
// Maybe the logic of CancelVolatileMode is just wrong.
General.Editing.CancelVolatileMode();
geometrychanged = false;
populationchanged = false;
General.Map.Map.ClearAllMarks(false);
@ -736,7 +739,6 @@ namespace CodeImp.DoomBuilder.Editing
}
}
}
}
Cursor.Current = oldcursor;
}

View file

@ -1401,6 +1401,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Cancel mode
public override void OnCancel()
{
// Only allow the following code to be run once
if (cancelled)
return;
base.OnCancel();
// Paste operation?