Thanks for the help, I appreciate it.
One thing I'm noticing is that even though GetFirstInterestedOffset is returning something other than -1, ConstructElement is never being called.
Also, in your example, 'CreateTextRun' returns a TextHidden of 1 length. Should this be returning the length of the escape sequence?
ie: In my case, an escape sequence might be 01b[1;37m, so would I return a length of 7 here? Sorry - I've not been able to test this yet since ConstructElement is not called.
Here is the code I'm using for GetFirstInterestedOffset
public override int GetFirstInterestedOffset(int startOffset)
DocumentLine endLine = CurrentContext.VisualLine.LastDocumentLine;
StringSegment relevantText = CurrentContext.GetText(startOffset, endLine.EndOffset - startOffset);
for (int i = 0; i < relevantText.Count; i++)
char c = relevantText.Text[relevantText.Offset + i];
if ((int)c == 27) // ESC
return startOffset + i;
and some example data... "01b
[0;37;44mNormal, White on Blue"
(where the '01b' is actually ANSI char #27, the escape character)