I am making a simple xhtml editor with syntax highlighting. The problem is that everything is stored in the richtextbox undo history. Even my underlining changes. I already found that there is a richtextbox.UndoActionName that should be "Unknown" if you programmatically change the richtextbox. So I tried something similar when pressing ctrl + z:
while(richtextbox.CanUndo && richtextbox.UndoActionName == "Unknown"){ richtextbox.Undo(); }
Which just selected all the text and practically did not cancel anything (just continued the cycle until I stopped it ...). So my question is, do I need to specify the undoactionname somewhere, or can I change the richtextbox to record the undo history for input only? Thanks.
Edit: It would be great if I could send a message to richtextbox to stop recording the cancellation history while I select or somehow exclude or actions with an Unknown name, is there any way to do this?
Edit 2: Well, I did it stupidly, I store all the text in a linked list, and when I refresh again, I clear the richtextbox and fill it with the last item from the list and then reselect. Maybe this helps someone
source share