I am trying to implement a behavior that will automatically change the XML end tag name when the corresponding XML start tag name is changed. The logic for this is very straightforward. I just add an event handler for DocumentTextChanged that does some token scanning to find the corresponding end tag, and then invoke SyntaxEditor.Document.ReplaceText(...). All of this works perfectly.
The problem is that the original text change and the automatic change to the matching end tag both get theeir own undo items. I'd really like them to have the same undo items. I can't figure out how to resolve this. Can I merge the two undo items? Can I remove the undo items and add back a new one? Can I provide an undo item for the ReplaceText to insert itself into? Something else? I don't see any hooks in the API to do any of the above.