I am trying to build a diffing utility into my application and want to show a blank, unnumbered line after certain lines to indicate a deleted line between 2 different files. Based on this thread I found, I'm trying to understand VisualLineElementGenerator and VisualLineElements. I've found a few exmaples of implementations and have managed the ability to insert blank/empty text runs at the begining and in the middle of lines, but not at the end. I've ben trying to maybe have my CreateTextRun function return something like:
Return New TextCharacters(Environment.NewLine + "!", Me.TextRunProperties)
But I get an exception saying "The returned TextRun is too long." & vbCrLf & "Parameter name: MyVisualLineElement.CreateTextRun"
Below is my class. How Can I achieve adding the EndOfLine at the end of a run so I get an empty secondary line (if the secondary line contains whitespace that is acceptable)? Thanks!
Private Class MyVisualLineElement Inherits VisualLineElement Public Sub New() MyBase.New(visualLength:=1, documentLength:=0) End Sub Public Overrides Function CreateTextRun(startVisualColumn As Integer, context As ITextRunConstructionContext) As TextRun Return New TextCharacters(Environment.NewLine + " ", Me.TextRunProperties) 'Return New TextEndOfLine(1) End FunctionEnd Class
To be clear, returning New TextEndOfLine(1) the the end of a run doesn't produce an error...it simply doesn't add any additional lines.