public sealed class UndoManagerThe ordinary in-memory undo stack.
Remarks
What a document with no command stack of its own wants, and what UiApplication installs so that a dialog's text box has ⌘Z without an application deciding to.
⚠ Bounded, and the bound is a decision. An edit is two closures over the strings either side of it, so an unbounded stack in a long-lived application is a copy of every version of every field it ever showed. Limit drops the oldest, which is what every editor does and is why "undo all the way to the beginning" is not a promise anything makes.
Fields and properties (6)
public int LimitHow many edits it keeps.
public bool CanUndoWhether there is anything to take back.
public bool CanRedoWhether there is anything to put back.
public bool IsPerformingWhether an undo or a redo is running right now.
public string? UndoNameWhat the next undo would take back, for a menu item's label.
public string? RedoNameWhat the next redo would put back.
Methods (4)
public void Register(string name, Action undo, Action redo)Records something that has already happened.
public bool Undo()Takes back the most recent edit.
public bool Redo()Puts back the most recently undone edit.
public void Clear()Forgets everything.
Used by (4)
- ResponderChainTestsVixen.Ui.Tests
- UiApplicationVixen.Ui.Desktop
- UndoCommandsTestsVixen.Ui.Tests
- UndoTestsVixen.Ui.Controls.Tests