for this reasons i want to suspend the listening of the stack (or do a pop after any textchange). but
do you know a possibility to solve this?
You want the undo stack to not record some changes, but don't want to be cleared it either? That would mean the contents of the undo stack might be inconsistent with the document content - when the user then presses undo, it might end up crashing or changing text other than in the expected location.
For this reason, AvalonEdit does not support this operation.
We try very hard to avoid inconsistent undo stacks - for example, re-entrant updates (changing the document within a TextDocument.Changed
event handler) are disallowed.
The closest you can get to disabling the undo stack is to set
document.UndoStack.SizeLimit = 0;
This will effectively disable listening for changes, but it'll also clear the undo stack.
As a side note: it is possible to 'detach' an undo stack (by setting document.UndoStack
to another undo stack), but that will also clear the old undo stack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With