Prevent RichTextBox from being added to the Undo lock stack

Editing the RichTextBox control text (more specifically, changing the font / color of the selection) programmatically seems to be tracked in the control built on the undo stack. Is there a way without writing my own undo / redo manager to prevent certain actions / operations from being added to the undo stack?

0
source share
2 answers

No cando. At best, you can completely clear the cancellation stack by sending EM_SETUNDOLIMIT twice. EM_SETTEXTEX offers the same option with the ST_DEFAULT flag. Surely not what you want. Take a look at ScintillaNET for a real editor.

+2
source

In fact, you can easily do this by implementing some ITextDocument interface and sending tomSuspend and tomResume as the count argument to the Undo handler.

-one
source

All Articles