LineGetter.SyntaxHighlightMatch

Subclasses that implement this function can enable syntax highlighting in the line as you edit it.

More...
class LineGetter
static
struct SyntaxHighlightMatch {
int charsMatched;
Color foreground;
Color background;
}

Detailed Description

The library will call this when it prepares to draw the line, giving you the full line as well as the current position in that array it is about to draw. You return a SyntaxHighlightMatch object with its charsMatched member set to how many characters the given colors should apply to. If it is set to zero, default behavior is retained for the next character, and syntaxHighlightMatch will be called again immediately. If it is set to -1 syntax highlighting is disabled for the rest of the line. If set to int.max, it will apply to the remainder of the line.

If it is set to another positive value, the given colors are applied for that number of characters and syntaxHighlightMatch will NOT be called again until those characters are consumed.

Note that the first call may have currentDrawPosition be greater than zero due to horizontal scrolling. After that though, it will be called based on your charsMatched in the return value.

currentCursorPosition is passed in case you want to do things like highlight a matching parenthesis over the cursor or similar. You can also simply ignore it.

line may have private data packed into the dchar bits if you enabled enableAutoCloseBrackets. Use ch & ~PRIVATE_BITS_MASK to get standard dchars.

Meta

History

Added January 25, 2021 (version 9.2)