In This Article

IUndoHistory Interface

Provides the base requirements for an object that tracks undo and redo history for a document and allows re-application of those text changes.

public interface IUndoHistory

Properties

CanRedo

Gets whether at least one redo text change is available to execute.

bool CanRedo { get; }

Property Value

bool:

true if there is at least one redo text change is available to execute; otherwise, false.

CanUndo

Gets whether at least one undo text change is available to execute.

bool CanUndo { get; }

Property Value

bool:

true if there is at least one undo text change is available to execute; otherwise, false.

RedoStack

Gets the IUndoableTextChangeStack containing the redo stack.

IUndoableTextChangeStack RedoStack { get; }

Property Value

IUndoableTextChangeStack:

The IUndoableTextChangeStack containing the redo stack.

UndoStack

Gets the IUndoableTextChangeStack containing the undo stack.

IUndoableTextChangeStack UndoStack { get; }

Property Value

IUndoableTextChangeStack:

The IUndoableTextChangeStack containing the undo stack.

Methods

Clear()

Clears the undo and redo stacks, without resetting change tracking.

void Clear()

Clear(bool)

Clears the undo and redo stacks.

void Clear(bool resetChangeTracking)
Parameter Type Description
resetChangeTracking bool

Whether to also reset all change tracking.

GetChangeTypeForLineRange(int, int)

Gets the SavePointChangeType for the specified line range.

SavePointChangeType GetChangeTypeForLineRange(int startLineIndex, int endLineIndex)
Parameter Type Description
startLineIndex int

The start index of the line range to examine.

endLineIndex int

The end index of the line range to examine.

Returns

SavePointChangeType:

The SavePointChangeType for the specified line range.

Redo()

Performs the top redo text change.

bool Redo()

Returns

bool:

true if redo text change occurred successfully; otherwise, false.

Redo(int)

Performs the specified number of redo text changes.

int Redo(int count)
Parameter Type Description
count int

The number of redo text changes to perform.

Returns

int:

The number of redo text changes that were performed.

Undo()

Performs the top undo text change.

bool Undo()

Returns

bool:

true if undo text change occurred successfully; otherwise, false.

Undo(int)

Performs the specified number of undo text changes.

int Undo(int count)
Parameter Type Description
count int

The number of undo text changes to perform.

Returns

int:

The number of undo text changes that were performed.

Events

Cleared

Occurs when the undo history is programmatically cleared.

event EventHandler Cleared

Event Type

EventHandler

Remarks

This event is raised when the Clear() method is called.

UndoRedoRequested

Occurs when an undo or redo operation is requested.

event EventHandler<UndoRedoRequestEventArgs> UndoRedoRequested

Event Type

EventHandler<UndoRedoRequestEventArgs>

Remarks

This event is raised when the Undo() or Redo() method is called.