1

Evening Everyone, I have a custom richtextbox where I do formatting and such to words as users type in the box. All works great...except when they hit ctrl+z or use the undo functionality. Instead of undoing their word they just typed, it goes back and starts to undo all of the formatting that was programmatically added.

So, is there a way to stop the "Undo capturing" (not sure what to call it...?) during the progrommatic changes then turn it back on after?

Here is an example that I can't find how to do:

User types word
----------------
pause adding to undo buffer
programmatic changes to formatting
start adding to undo buffer
----------------
user hits ctrl+z and word they just typed is undone

Thanks

Bulsatar
  • 45
  • 7
  • 1
    Just call RichTextBox.ClearUndo() after you made changes yourself. Do tag your question properly, nobody can tell what GUI class library you use. – Hans Passant Nov 09 '15 at 21:58
  • 1
    added the tag...That isn't what I was looking for tho as that clears everything in the undo buffer. I want them to be able to undo the word they just typed but I do not want all of the formatting actions in the buffer. so here would be the sequence: type word->format word programmatically->user hits ctrl+z->word they just typed is undone – Bulsatar Nov 10 '15 at 13:23
  • You are asking for a pony. Libraries that implement a real text editor or word processor are widely available. – Hans Passant Nov 10 '15 at 13:34
  • You've [already said that](http://stackoverflow.com/a/2614526/11683) @HansPassant ;) – GSerg Nov 10 '15 at 13:38

0 Answers0