Best way to detect line-range changes in SyntaxEditor

SyntaxEditor for WPF Forum

Posted 10 years ago by James Deadman
Version: 10.1.0522
Avatar
Can i please ask the best way to detect line-range changes in the SyntaxEditor.

For example, our application has internal lists of breakpoints and bookmarks that we would need to update if any lines change in the Editor (e.g. lines inserted or removed).

Ideally i would need to know when the following occur, and the line range (start line and end line) that has been affected:

* Lines inserted
* Lines removed
* Lines cut / pasted
* Lines replaced (would need to know line-range removed and the range inserted/replaced)

Im hoping i can capture events in one place to make it easier. I understand there is the DocumentTextChanged() event but im not sure if this is the correct way to do this and how to detect the above from this if so.

Thank you for any help.

James

Comments (2)

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

A handler for SyntaxEditor.DocumentTextChanged is sent EditorSnapshotChangedEventArgs.

The TextChange property of the EditorSnapshotChangedEventArgs has an Operations collection. Each of these operations has the range information you need.

The TextChange property of the EditorSnapshotChangedEventArgs also has a Type property which tells you what sort of text change it is.

Please let us know if you have further questions.


Actipro Software Support

Posted 10 years ago by James Deadman
Avatar
Hi,

Thanks very much for your help.

I have used the Operations member of the DocumentTextChanged() event as you suggested and that did the trick. It was very straight forward to use :-)

Regards,
James
The latest build of this product (v2019.1 build 0683) 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.