Assembly: Microsoft.VisualStudio.TextManager.Interop (in microsoft.visualstudio.textmanager.interop.dll)
int OpenLinkedUndo ( /** @attribute InAttribute() */ UInt32 dwFlags, /** @attribute InAttribute() */ String pszDescription )
[in] Value taken from theenumeration. specifies the transaction to be nonstrict, which is default behavior. The other possible enum values are which specifies the undo linking behavior as strict, and , which specifies the undo linking behavior as global. For more information, see the Remarks section later in this topic.
[in] Localized string that describes this action; appears in the undo/redo dropdown menus. This value may not be a null reference (Nothing in Visual Basic).
Return ValueIf the method succeeds, it returns . If it fails, it returns an error code.
[in] DWORD dwFlags,
[in] const WCHAR *pszDescription
Nonstrict linked undo behavior (mdtDefault) means that some of the documents with linked undo siblings can close and still leave the other linked undo siblings on their stacks. An example of nonstrict undo behavior is found in the Microsoft® Office® suite. Microsoft Word allows one file to close during a drag-and-drop operation in such a way that one file loses information.
Strict linked undo behavior specifies that all the linked undo sibling stacks have to be undone together or not at all. A strict linked undo operation (mdtStrict) is usually necessary in editorial changes that involve simultaneous text changes across multiple program files, such as a header file and a Visual C++ file. This is, in fact, the model used in Visual Studio.
A global undo operation (mdtGlobal) is a strict undo behavior as well, the only difference being that the affected documents need not be open in the Visual Studio IDE to have their changes reversed. One example of this is if you were to undo a Rename refactoring operation on a variable name in a project. The undo reverts the rename changes in all affected documents of the project, regardless of whether they are currently open in the IDE.
Any buffer that is opened (but not necessarily changed) during an mdtGlobal undo transaction is flagged as a buffer that participates in the global buffer undo operation. The undo stacks of those buffers (documents) are preserved if the buffers are closed and then reopened again in the same IDE session.
To enable global undo when creating your own implementation of— using a as a buffer for your implementation of DocData — be sure to site the DocData properly by calling with a valid service provider. In addition, you must call on your VsTextBuffer.