private void SourceSpansChanged(object sender, ProjectionSourceSpansChangedEventArgs e)
        {
            if (e.Changes.Count == 0)
            {
                // If there weren't text changes, but there were span changes, then
                // send out a classification changed event over the spans that changed.
                ProjectionSpanDifference difference = ProjectionSpanDiffer.DiffSourceSpans(this.diffService, e.Before, e.After);
                int pos   = 0;
                int start = int.MaxValue;
                int end   = int.MinValue;
                foreach (var diff in difference.DifferenceCollection)
                {
                    pos  += GetMatchSize(difference.DeletedSpans, diff.Before);
                    start = Math.Min(start, pos);

                    // Now, for every span added in the new snapshot that replaced
                    // the deleted spans, add it to our span to raise changed events
                    // over.
                    for (int i = diff.Right.Start; i < diff.Right.End; i++)
                    {
                        pos += difference.InsertedSpans[i].Length;
                    }

                    end = Math.Max(end, pos);
                }

                if (start != int.MaxValue && end != int.MinValue)
                {
                    RaiseTagsChangedEvent(new SnapshotSpan(e.After, Span.FromBounds(start, end)));
                }
            }
        }
 public ProjectionSpanToNormalizedChangeConverter(ProjectionSpanDiffer differ,
                                                  int textPosition,
                                                  ITextSnapshot currentSnapshot)
 {
     this.differ          = differ;
     this.textPosition    = textPosition;
     this.currentSnapshot = currentSnapshot;
 }