private static IReadOnlyList <ImmutableArray <TextChangeRange> > GetChangesBetween(SourceText oldText, ChangedText newText) { var list = new List <ImmutableArray <TextChangeRange> >(); var change = newText._info; list.Add(change.ChangeRanges); while (change != null) { SourceText actualOldText; change.WeakOldText.TryGetTarget(out actualOldText); if (actualOldText == oldText) { return(list); } change = change.Previous; if (change != null) { list.Insert(0, change.ChangeRanges); } } // did not find old text, so not connected? list.Clear(); return(list); }