Exemplo n.º 1
0
 void PushColor(HighlightingColor color)
 {
     if (highlightedLine == null)
     {
         return;
     }
     if (color == null)
     {
         highlightedSectionStack.Push(null);
     }
     else if (lastPoppedSection != null && lastPoppedSection.Color == color &&
              lastPoppedSection.Offset + lastPoppedSection.Length == position + lineStartOffset)
     {
         highlightedSectionStack.Push(lastPoppedSection);
         lastPoppedSection = null;
     }
     else
     {
         HighlightedSection hs = new HighlightedSection {
             Offset = position + lineStartOffset,
             Color  = color
         };
         highlightedLine.Sections.Add(hs);
         highlightedSectionStack.Push(hs);
         lastPoppedSection = null;
     }
 }
Exemplo n.º 2
0
 void ResetColorStack()
 {
     Debug.Assert(position == 0);
     lastPoppedSection = null;
     if (highlightedLine == null)
     {
         highlightedSectionStack = null;
     }
     else
     {
         highlightedSectionStack = new Stack <HighlightedSection>();
         foreach (HighlightingSpan span in spanStack.Reverse())
         {
             PushColor(span.SpanColor);
         }
     }
 }
Exemplo n.º 3
0
        void PopColor()
        {
            if (highlightedLine == null)
            {
                return;
            }
            HighlightedSection s = highlightedSectionStack.Pop();

            if (s != null)
            {
                s.Length = (position + lineStartOffset) - s.Offset;
                if (s.Length == 0)
                {
                    highlightedLine.Sections.Remove(s);
                }
                else
                {
                    lastPoppedSection = s;
                }
            }
        }
Exemplo n.º 4
0
 void ResetColorStack()
 {
     Debug.Assert(position == 0);
     lastPoppedSection = null;
     if (highlightedLine == null) {
         highlightedSectionStack = null;
     } else {
         highlightedSectionStack = new Stack<HighlightedSection>();
         foreach (HighlightingSpan span in spanStack.Reverse()) {
             PushColor(span.SpanColor);
         }
     }
 }
Exemplo n.º 5
0
 void PushColor(HighlightingColor color)
 {
     if (highlightedLine == null)
         return;
     if (color == null) {
         highlightedSectionStack.Push(null);
     } else if (lastPoppedSection != null && lastPoppedSection.Color == color
                && lastPoppedSection.Offset + lastPoppedSection.Length == position + lineStartOffset)
     {
         highlightedSectionStack.Push(lastPoppedSection);
         lastPoppedSection = null;
     } else {
         HighlightedSection hs = new HighlightedSection {
             Offset = position + lineStartOffset,
             Color = color
         };
         highlightedLine.Sections.Add(hs);
         highlightedSectionStack.Push(hs);
         lastPoppedSection = null;
     }
 }
Exemplo n.º 6
0
 void PopColor()
 {
     if (highlightedLine == null)
         return;
     HighlightedSection s = highlightedSectionStack.Pop();
     if (s != null) {
         s.Length = (position + lineStartOffset) - s.Offset;
         if (s.Length == 0)
             highlightedLine.Sections.Remove(s);
         else
             lastPoppedSection = s;
     }
 }