I saw the post about finding the scheme state under the editor cursor and thought I’d try to find the scheme style as well. As a test when I click on an area, the style of the text is shown in my status bar. This also helps me follow what’s happening when I change my regex codes in the scheme states. Is there a better way of finding the style?
Dim linepos As Point = MyEditor.Source.Position
Dim item As IStringItem = MyEditor.Lines.GetItem(linepos.Y)
Dim data() As StringItemInfo = item.TextData
Dim style = data(linepos.X) ' code for the lexer style at the cursor?
Dim stylecode = style.Data ' get stringitem' symbol data (byte)
If stylecode < 1 Then stylecode = 1
Dim StyleNameUnderCursor = ""
For Each schemeStyle In parser1.Scheme.Styles
If schemeStyle.Index = (stylecode - 1) Then
StyleNameUnderCursor = schemeStyle.Name
End If
Next