Undo/Redo for SpanIndicators

SyntaxEditor for Windows Forms Forum

Posted 11 years ago by Walter Leinert - Hewlett Packard GmbH
Avatar
Hi,

currently i'm evaluating/prototyping the syntax editor control.
How do i handle undo/redo for custom commands e.g. for highlighting text ranges by span indicators?

Walter

Comments (3)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Walter,

Can you explain in a bit more detail about your scenario? Thanks!


Actipro Software Support

Posted 11 years ago by Walter Leinert - Hewlett Packard GmbH
Avatar
We have to implement some kind of enhanced/customized text editor (not primarily a syntax editor) with e.g. features to highlight words or char ranges, to mark words as deleted (striked throu) or to mark them as added. For these commands i would like to have them undoable (the text changes as well as the corresponding highlight operations).

I implemented one custom EditCommand (like HighlightTextCommand) which simply adds a HighlightSpanIndicator to some text range and i did not find a way to make this command undoable/redoable (remove the highlighting).
Isn't it possible or did'nt i find the right samples or documentation?

Regards, Walter
Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks for the reply Walter. This sort of usage is a bit different than for what SyntaxEditor was designed.

The built-in undo/redo mechanism only supports text changes and doesn't restore indicators. However you possibly could track them yourself by attaching to the various events on SyntaxEditor such as DocumentIndicatorAdded, DocumentIndicatorRemoved, etc. and maintaining a stack somehow based on DocumentTextChanged events.


Actipro Software Support

The latest build of this product (v2020.1 build 0400) was released 5 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.