So I have implemented a smart indentation scheme and it works wonderfully. It is currently implemented in the OnDocumentTextChanged() method override. However, there seems to be an issue when a person undoes or redoes things, in that the undo and redo actions fire OnDocumentTextChanged() with the same DocumentModification types as when the code was first written. This is a problem in that it tries to execute the smart indentation code when undoing/redoing, which results in an Actipro exception being thrown from the UndoRedo stack. I've tried finding a way to detect whether something is an undo / redo action in OnDocumentTextChanged(), but I don't think there is a way to detect it.
What would you recommend doing to alleviate this issue? Is there some way to detect whether something is an undo action from inside the OnDocumentTextChanged() method? If not, is there a better place to do smart indentation logic?
Thanks in advance.