예제 #1
0
        public TextVersion SetChanges(IList <ITextChange> changes, int?reiteratedVersionNumber = null)
        {
            var normalizedChanges = NormalizedTextChangeCollection.Create(changes);
            int reiterVerNum      = reiteratedVersionNumber ?? (changes.Count == 0 ? ReiteratedVersionNumber : VersionNumber + 1);
            int newLength         = Length;

            foreach (var c in normalizedChanges)
            {
                newLength += c.Delta;
            }
            Debug.Assert(newLength >= 0);
            var newVersion = new TextVersion(TextBuffer, newLength, VersionNumber + 1, reiterVerNum, textImageVersion.Identifier);

            textImageVersion.SetChanges(normalizedChanges, newVersion.textImageVersion);
            Next = newVersion;
            return(newVersion);
        }
예제 #2
0
        public TextVersion SetChanges(IList <ITextChange> changes, int?reiteratedVersionNumber = null)
        {
            var normalizedChanges = NormalizedTextChangeCollection.Create(changes);

            if (reiteratedVersionNumber == null)
            {
                reiteratedVersionNumber = changes.Count == 0 ? ReiteratedVersionNumber : VersionNumber + 1;
            }
            int newLength = Length;

            foreach (var c in normalizedChanges)
            {
                newLength += c.Delta;
            }
            Debug.Assert(newLength >= 0);
            var newVersion = new TextVersion(TextBuffer, newLength, VersionNumber + 1, reiteratedVersionNumber.Value);

            Changes = normalizedChanges;
            Next    = newVersion;
            return(newVersion);
        }