void BeginColorSpan()
 {
     WriteIndentationIfNecessary();
     colorStack.Push(currentColor);
     currentColor      = currentColor.Clone();
     currentColorBegin = documentTextWriter.InsertionOffset;
 }
예제 #2
0
        /// <summary>
        /// Sets the HighlightingColor for the specified range of text,
        /// completely replacing the existing highlighting in that area.
        /// </summary>
        public void SetHighlighting(int offset, int length, HighlightingColor color)
        {
            if (length <= 0)
            {
                return;
            }
            int startIndex = GetIndexForOffset(offset);
            int endIndex   = GetIndexForOffset(offset + length);

            stateChanges[startIndex] = color != null?color.Clone() : new HighlightingColor();

            stateChanges.RemoveRange(startIndex + 1, endIndex - (startIndex + 1));
            stateChangeOffsets.RemoveRange(startIndex + 1, endIndex - (startIndex + 1));
        }