Ace编辑器暂停/禁用UndoManager [英] Ace Editor Pause/Disable UndoManager

查看:568
本文介绍了Ace编辑器暂停/禁用UndoManager的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 有什么方法可以从UndoManager中删除特定的堆栈值

OR


  • 任何用于暂停/禁用的功能再次启动/启用 UndoManager。

  • any function to pause/disable and start/enable UndoManager again.

我希望不要将特定数据推送到 UndoManager的堆栈中

I want not to push specific data to UndoManager's stack.

推荐答案

不可能简单地不将增量推入堆栈,因为在这种情况下,撤消先前获得的增量不可能,您还需要围绕跳过的增量转换增量。
说,如果您有文档 xyz ,其中 {插入,2, a} 用于获取 xyaz ,然后 {插入,1, b} 来获取 xbyaz 。现在要撤消第一个编辑但保留第二个编辑,则需要应用 {delete,2 + 1, a} 。这样做的算法不是很复杂,但是它需要处理许多分支,因此会变得很毛茸茸。 Ace没有为此atm提供api。

It is not possible to simply not push deltas to the stack, since in that case undoing previous deltas won't be possible, you need to also transform the deltas around skipped delta. Say if you have a document "xyz" to which {insert, 2, "a"} is applied to obtain "xyaz" and then {insert, 1, "b"} to get "xbyaz". Now to undo the first edit but keep second one you need to apply {delete, 2+1, "a"}. The algorithm for doing this is not very complex, but it requires to handle many branches, so can get hairy. Ace doesn't provide an api for this atm.

这篇关于Ace编辑器暂停/禁用UndoManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆