1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Add warning when performing destructive undo of global operation

This commit is contained in:
Brian Fiete 2024-11-21 05:56:18 -05:00
parent d695226657
commit d1a2c53bd7
2 changed files with 103 additions and 1 deletions

View file

@ -278,6 +278,31 @@ namespace Beefy.utils
return true;
}
public void PreUndo(delegate void (UndoAction) dlg)
{
int undoIdx = mUndoIdx;
if (undoIdx == 0)
return;
var undoAction = mUndoList[undoIdx - 1];
if (IUndoBatchEnd undoBatchEnd = undoAction as IUndoBatchEnd)
{
while (true)
{
dlg(undoAction);
if (undoIdx == 0)
return;
undoIdx--;
if ((undoAction == undoBatchEnd.BatchStart) || (undoIdx == 0))
return;
undoAction = mUndoList[undoIdx - 1];
}
}
dlg(undoAction);
undoIdx--;
}
public bool Redo()
{
mSkipNextMerge = true;