public void Undo() { if (history.Count > 0) { var cmd = history.Pop(); BeginDisableCommands(); //prevent text changing into handlers try { cmd.Undo(); } finally { EndDisableCommands(); } redoStack.Push(cmd); } //undo next autoUndo command if (history.Count > 0) { UndoableCommand cmd = history.Peek(); if (cmd.autoUndo || cmd is InsertCharCommand) { Undo(); } } TextSource.CurrentTB.OnUndoRedoStateChanged(); }
public MultiRangeCommand(UndoableCommand command) : base(command.ts) { this.cmd = command; range = ts.CurrentTB.Selection.Clone(); }