Exemple #1
0
        private void CalculateSections(IEnumerable <VisualLine> visualLines)
        {
            foreach (var lineSegment in visualLines)
            {
                if (lineSegment.VisualLength == 0)
                {
                    continue;
                }

                var section = new Section(lineSegment.StartOffset,
                                          lineSegment.LastDocumentLine.EndOffset,
                                          lineSegment.LastDocumentLine.DelimiterLength);

                var firstChar = lineSegment.Document.GetCharAt(lineSegment.StartOffset);
                switch (firstChar)
                {
                case '+':
                    HighlighterHelper.AddToSection(_plusLinesSections, section);
                    break;

                case '-':
                    HighlighterHelper.AddToSection(_minusLinesSections, section);
                    break;

                case '@':
                case '\\':
                    HighlighterHelper.AddToSection(_headers, section);
                    break;
                }
            }
        }