AvalonStudio.TextEditor.Document.UndoStack.PushOptional C# (CSharp) Method

PushOptional() public method

Call this method to push an UndoableOperation on the undostack. However, the operation will be only stored if the undo group contains a non-optional operation. Use this method to store the caret position/selection on the undo stack to prevent having only actions that affect only the caret and not the document.
public PushOptional ( IUndoableOperation operation ) : void
operation IUndoableOperation
return void
		public void PushOptional(IUndoableOperation operation)
		{
			if (undoGroupDepth == 0)
				throw new InvalidOperationException("Cannot use PushOptional outside of undo group");
			Push(operation, true);
		}