How do I clear the undo stack RRS feed

  • Question

  • I have a HTML editor integrated with Visual Studio. I use the IMarkupServise to put entries onto the stack using the "BeginUndoUnit" and "EndUndoUnit".


    I call the 'Undo' and 'Redo' using the execCommand, but how do I clear the stack?

    Tuesday, May 1, 2007 5:23 AM


  • The undo stack can only be cleared by closing the document. When an item is undone, it is transferred to the redo stack, and when redone moved back onto the undo stack. You can coalesce multiple changes into one item, but you cannot remove those items from the stack, otherwise items previously added to the stack will not work. For example, suppose the user deletes 3 chars from the start of the 8th line. Then they remove lines 2-4, which is then removed from the undo stack. If they try to undo the deletion from the 8th line, it will really be deleting from what was line 11, because line 11 has been moved down to line 8.



    Wednesday, June 13, 2007 10:41 PM