예제 #1
0
 /// <inheritdoc/>
 public HighlightedLine HighlightLine(int lineNumber)
 {
     ThrowUtil.CheckInRangeInclusive(lineNumber, "lineNumber", 1, document.LineCount);
     CheckIsHighlighting();
     isHighlighting = true;
     try {
         HighlightUpTo(lineNumber);
         DocumentLine line = document.GetLineByNumber(lineNumber);
         highlightedLine = new HighlightedLine(document, line);
         HighlightLineAndUpdateTreeList(line, lineNumber);
         return(highlightedLine);
     } finally {
         highlightedLine = null;
         isHighlighting  = false;
     }
 }
예제 #2
0
        /// <inheritdoc/>
        protected override void Colorize(VisualLine line)
        {
            IHighlighter highlighter = line.TextLayer.Services.GetService(typeof(IHighlighter)) as IHighlighter;

            if (highlighter != null)
            {
                lineNumberBeingColorized = line.DocumentLine.LineNumber;
                HighlightedLine hl = highlighter.HighlightLine(lineNumberBeingColorized);
                lineNumberBeingColorized = 0;
                foreach (HighlightedSection section in hl.Sections)
                {
                    if (IsEmptyColor(section.Color))
                    {
                        continue;
                    }

                    ChangeVisualElements(section.Offset, section.Offset + section.Length,
                                         visualLineElement => ApplyColorToElement(visualLineElement, section.Color));
                }
            }
        }