Merging 'Typing' text changes in undo stack with customized rules

SyntaxEditor for WPF Forum

Posted 8 years ago by James Zheng
Version: 16.1.0633
Avatar

Hi Actipro,

It's known that when user types in a series of characters, the text change for every character typed is going to be merged into a single undo action in the undo stack. This is good for performance.

In our context, there is a need to separate them in some circumstances. For example, if user types in 'if(a == b)', I need serveral undo actions. one for 'if', one for '(', one for 'a ', one for '==', one for ' b' and one for ')'.

Is there a way for me to define a list of words that prevent the merge for 'Typing' text changes, if a 'Typing' text change begins with one of those words in the defined list?

Regards,

James Zheng

Comments (4)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

Unfortunately no, logic deep in the undo history is just combining sequential text changes of kind Typing together.  It's not examining text characters or anything, only offsets.


Actipro Software Support

Posted 8 years ago by James Zheng
Avatar

Hi Actipro,

Is it possible to have this feature?

Thanks and regards,

James Zheng

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi James,

This is sort of a non-standard functionality and isn't very straighforward to implement since the logic we currently have is nested deeply in the undo feature area.  All of that would need to be refactored.  I will write down the request for it, but it likely will be a lower priority item for those reasons.  How would you like to see it implemented API-wise?


Actipro Software Support

Posted 8 years ago by James Zheng
Avatar

Hi Actipro,

If this could be implemented, I would prefer it to be configurable to set the words. If the words are not set or null, it should work the same way as before. One possible way is to implement it as a property of the undo history.

For example:

Document.UndoHistory.WordBreakerForTyping = new List<string>() {"word1", "word2"};

Or make use of the existing rules in the word break finder in the language, but I'm not sure how this could be implemented.

I'm requesting this functionality as the new editor needs to be backward compatible with the old editor, which many existing users are familiar with.

Regards,

James Zheng

[Modified 8 years ago]

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.