Working on Document lines in a selection

SyntaxEditor for Windows Forms Forum

Posted 15 years ago by Joachim Schwieren
Version: 4.0.0282
Avatar
Hi,

my question: I can modify a document line by line when using SyntaxEditor.Document.Lines[n]. This works fine for the while document. But is there a similar functionality to iterate through only those lines that are currently selected?

What I am looking for would be something like: SyntaxEditor.SelectedView.Selection.Lines[n]. Is there a similar functionality that allows me to iterate through the currently selected lines?

Thanks,

Joe

Comments (2)

Posted 15 years ago by Ernesto Obregon
Avatar
I used something like this

' Get first and last line positions of the currently selected text/lines
Dim firstLine As Integer = SyntaxEditor.SelectedView.Selection.FirstEditPosition.Line
Dim lastLine As Integer = SyntaxEditor.SelectedView.Selection.LastEditPosition.Line

Dim index As Integer
' Iterate through all selected lines
For index = firstLine To lastLine
     ' Do you editing here on each individual line
Next
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Joachim,

editor.SelectedView.EditPositionRange will give you an edit position range, where edit positions are the display lines in the view (which may not match the document lines due to word wrap, outlining, etc). However there is a DocumentPositionRange property as well that gives you the document line position range.

As Ernesto pointed out there are other related properties like FirstEditPosition, etc. too.


Actipro Software Support

The latest build of this product (v24.1.0) 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.