Hi,
How do I add text to each line at the beginning and end of a selection? I have done it in a richtextbox, but I can't seem to 'convert' it to syntaxeditor.
With RichTextBox1
Dim startAt As Integer = .GetFirstCharIndexFromLine(.GetLineFromCharIndex(.SelectionStart))
Dim endAt As Integer = .Text.IndexOf(vbLf, .SelectionStart + .SelectionLength) - 1
endAt = If(endAt < 0, .Text.Length, endAt)
.SelectionStart = startAt
.SelectionLength = endAt - startAt + 1
'format selected lines
Dim lines As New List(Of String)(.SelectedText.Split(New String() {vbLf}, StringSplitOptions.RemoveEmptyEntries))
If lines.Count > 0 Then
lines = Array.ConvertAll(lines.ToArray, Function(s) " [line]" & s & "[/line]").ToList
lines.Insert(0, "[start]")
lines.Add("[/start]")
End If
.SelectedText = String.Join(vbLf, lines.ToArray)
End With