title: C# RichTextBox: Highlighting + Undo
body: <p>I'm doing a simple xhtml editor with syntax highlighting.
  The problem is that in richtextbox undo history everything is stored. Even my highlighting changes.
  I already found that there is a <code>richtextbox.UndoActionName</code> which should be "Unknown" if you change the richtextbox programatically. So I tried something like this when ctrl+z is pressed:</p>
  
  <pre><code>while(richtextbox.CanUndo &amp;&amp; richtextbox.UndoActionName == "Unknown"){
      richtextbox.Undo();
  }
  </code></pre>
  
  <p>Which just selected my whole text and did not actually undo anything (just kept looping until I stopped it...).
  So my question is whether I need to specify somewhere the undoactionname myself or whether I can change the richtextbox to record undo history only for typing?
  Thanks.</p>
  
  <p><strong>Edit:</strong> It would be cool if I could send a message to richtextbox to stop recording undo history while i'm highlighting or to somehow exclude or actions with Unknown name, is there any way to do this?</p>
  
  <p><strong>Edit 2:</strong> Well I've done it the stupid way, I'm storing the whole text in linked list and when redoing I clear the richtextbox and fill it with last item from the list and then re-highlight. Maybe this helps anyone</p>