从“撤消堆栈"中删除动作.在RichTextBox控件中 [英] Removing actions from "Undo Stack" in RichTextBox control

查看:83
本文介绍了从“撤消堆栈"中删除动作.在RichTextBox控件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,:)

有什么方法可以从撤消缓冲区中删除操作?

我创建了一个基本的RichTextBox语法荧光笔.键入时,它将在您当前正在编辑的行中搜索关键字.找到关键字后,它将选择该关键字,然后为其添加颜色.

我的意思是:我输入浮船"一词. "float"一词是一个关键字,将被选择,然后更改其颜色..."boat"不是一个关键字,将被单独放置.这是输入序列:

f,l,o,a,t,浮点数,空格的选择,b,o,a,t

因此,当您撤消对两个单词的键入时,一切都很好,直到您尝试撤消对float中的"t"的键入为止.您必须按两次undo,一次要撤消对float的选择,一次要撤消"t".

我想在撤消缓冲区中拥有的全部是:
f,l,o,a,t,空间,b,o,a,t
而不是单词的选择.

任何想法将不胜感激!

〜Rich〜

Hello, :)

Is there any way to remove actions from the undo buffer?

I have created a basic RichTextBox syntax highlighter. As you type it will search for key words within the line you are currently editing. When a key word is found it will select that word then apply a color to it.

Here is what I mean: I type the words "float boat". The word "float" is a key word and will be selected then it''s color changed... "boat" is not a key word and will be left alone. This is the input sequence:

f, l, o, a, t, selection of float, space, b, o, a, t

So, when you undo the typing of the two words all is well until you try to undo the typing of the "t" in float. You have to press undo twice, once to undo the selection of float and once to undo the "t".

All I want to have in the undo buffer is:
f, l, o, a, t, space, b, o, a, t
but not the selection of the word.

Any ideas will be greatly appreciated!

~Rich~

推荐答案

正如SAKryukov在他的评论中所述,这与剪贴板无关.在文本中选择关键字并对其应用样式之后,请调用ClearUndo().这将从撤消缓冲区中清除最新操作,然后应选择单词.

最好的问候,

曼弗雷德(Manfred)
As SAKryukov stated in his comment this has nothing to do with the clipboard. After selecting the key word in your text and applying the styling to it call ClearUndo(). This clears the most recent operation from the undo buffer which should then be the selection of the word.

Best Regards,

Manfred


这篇关于从“撤消堆栈"中删除动作.在RichTextBox控件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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