Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

IVsUndoUnit Interface

Determines if the undo unit applies to UI items only.

Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in microsoft.visualstudio.textmanager.interop.dll)

[InterfaceTypeAttribute(1)] 
[GuidAttribute("A8C3D107-7EDF-4B1B-8A81-080AC91590E9")] 
public interface IVsUndoUnit
/** @attribute InterfaceTypeAttribute(1) */ 
/** @attribute GuidAttribute("A8C3D107-7EDF-4B1B-8A81-080AC91590E9") */ 
public interface IVsUndoUnit
InterfaceTypeAttribute(1) 
GuidAttribute("A8C3D107-7EDF-4B1B-8A81-080AC91590E9") 
public interface IVsUndoUnit

Interface exposed by IOleUndoUnit or IOleParentUndoUnit if UI-only undo items (like text selection and/or caret movements) are going to be put on the undo stack. The UI only undo units do not reset the redo stack. Normally, when a new undo unit is added to the undo stack, the redo stack is cleared. However, if the undo unit is not a data changing undo, then you can use IOleUndoUnit to make sure the redo stack does not get cleared. This allows undo units that change the UI only (cursor movements, for example) to not to interfere with the users ability to perform a redo.

The environment's implementation of IOleUndoManager looks for IOleUndoUnit and if it finds it, it calls fChangeData method to determine whether this is a UI-only undo unit fChangeData returns false). This interface can also be implemented in linked undo transaction to make the linked undo siblings ignore UI only undo actions in a linked document. For more information on linked undo transactions, see How to: Implement Linked Undo Management.

Notes to Implementers Implement this interface if you have UI only undo items that go on the undo stack and you need to make sure the redo stack does not get reset. Implement this interface also if you have a linked undo transaction situation, where you want the siblings to ignore undo actions that involve UI only in another linked sibling.

Community Additions

ADD
Show:
© 2015 Microsoft