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;
                }
            }
        }
Exemple #2
0
        private void AddMarkerForDifferences(IMarkerRender markerRender, ITextSource textSource)
        {
            if (!_minusLinesSections.Any())
            {
                return;
            }

            if (!_plusLinesSections.Any())
            {
                return;
            }

            var intersections = HighlighterHelper.GetIntersections(_minusLinesSections, _plusLinesSections);

            foreach (var intersection in intersections)
            {
                HighlighterHelper.MarkDifferenceForSection(intersection.Item1,
                                                           intersection.Item2, markerRender, textSource, Differ);
            }
        }