/// <summary>
 /// Gets the span stack at the end of the specified line.
 /// -> GetSpanStack(1) returns the spans at the start of the second line.
 /// </summary>
 /// <remarks>
 /// GetSpanStack(0) is valid and will return <see cref="InitialSpanStack"/>.
 /// The elements are returned in inside-out order (first element of result enumerable is the color of the innermost span).
 /// </remarks>
 public SpanStack GetSpanStack(int lineNumber)
 {
     ThrowUtil.CheckInRangeInclusive(lineNumber, "lineNumber", 0, document.LineCount);
     if (firstInvalidLine <= lineNumber)
     {
         UpdateHighlightingState(lineNumber);
     }
     return(storedSpanStacks[lineNumber]);
 }
 /// <inheritdoc/>
 public HighlightedLine HighlightLine(int lineNumber)
 {
     ThrowUtil.CheckInRangeInclusive(lineNumber, "lineNumber", 1, document.LineCount);
     CheckIsHighlighting();
     isHighlighting = true;
     try {
         HighlightUpTo(lineNumber - 1);
         IDocumentLine   line   = document.GetLineByNumber(lineNumber);
         HighlightedLine result = engine.HighlightLine(document, line);
         UpdateTreeList(lineNumber);
         return(result);
     } finally {
         isHighlighting = false;
     }
 }
Exemplo n.º 3
0
 /// <inheritdoc/>
 public SpanStack GetSpanStack(int lineNumber)
 {
     ThrowUtil.CheckInRangeInclusive(lineNumber, "lineNumber", 0, document.LineCount);
     if (firstInvalidLine <= lineNumber)
     {
         CheckIsHighlighting();
         isHighlighting = true;
         try {
             HighlightUpTo(lineNumber + 1);
         } finally {
             isHighlighting = false;
         }
     }
     return(storedSpanStacks[lineNumber]);
 }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the text line containing the specified visual column.
 /// </summary>
 public TextLine GetTextLine(int visualColumn)
 {
     ThrowUtil.CheckInRangeInclusive(visualColumn, "visualColumn", 0, VisualLength);
     if (visualColumn == VisualLength)
     {
         return(TextLines[TextLines.Count - 1]);
     }
     foreach (TextLine line in TextLines)
     {
         if (visualColumn < line.Length)
         {
             return(line);
         }
         else
         {
             visualColumn -= line.Length;
         }
     }
     throw new InvalidOperationException("Shouldn't happen (VisualLength incorrect?)");
 }