[英]How to Suspend the Undostack of Avalonedit?
for this reasons i want to suspend the listening of the stack (or do a pop after any textchange). 由于这个原因,我想暂停监听堆栈(或在任何textchange之后执行pop)。 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. 因此,AvalonEdit不支持此操作。 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. 我们非常努力地避免不一致的撤销堆栈 - 例如,不允许重入更新(在
TextDocument.Changed
事件处理程序中更改文档)。
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. 作为旁注:可以“分离”撤销堆栈(通过将
document.UndoStack
设置为另一个撤消堆栈),但这也将清除旧的撤消堆栈。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.