I want to implement something that programmatically changes the background of the text when there is a document line. (Something like choosing a block of text. I will use this to debug the IDE breakpoints I design). I do not want to use the selection, as it causes the text field to scroll.
I think I need to use DocumentColorizingTransformer, but I'm not 100% sure how to do this.
public class ColorizeAvalonEdit : ICSharpCode.AvalonEdit.Rendering.DocumentColorizingTransformer { protected override void ColorizeLine(ICSharpCode.AvalonEdit.Document.DocumentLine line) { int lineStartOffset = line.Offset; string text = CurrentContext.Document.GetText(line); int start = 0; int index; if (line.LineNumber == LogicSimViewCodeWPFCtrl.currentLine) { while ((index = text.IndexOf(text, start)) >= 0) { base.ChangeLinePart( lineStartOffset + index,
currentLine is the part to be highlighted.
The above code is working correctly .. only the problem is that currentLine ever changes while I look at this line, it does not highlight the updated line until I go to another part of the document (hiding the updated line) and go back to the updated line.
Also, how to make line numbers starting from scratch?
source share