예제 #1
0
        public TextSnapshotMock CreateNextSnapshot(string content, TextChangeMock change)
        {
            Change = change;
            var nextVersion = _version.CreateNextVersion(change);

            return(new TextSnapshotMock(content, TextBuffer, nextVersion));
        }
예제 #2
0
        public TextSnapshotMock CreateNextSnapshot(string content, TextChangeMock change) {
            Change = change;
            TextVersionMock nextVersion = _version.CreateNextVersion(change);
            TextSnapshotMock nextSnapshot = new TextSnapshotMock(content, TextBuffer, nextVersion);

            return nextSnapshot;
        }
예제 #3
0
        public TextVersionMock CreateNextVersion(TextChangeMock change)
        {
            _change = change;
            var nextVersion = new TextVersionMock(TextBuffer, VersionNumber + 1, Length + _change.Delta);

            Next = nextVersion;
            return(nextVersion);
        }
예제 #4
0
        public TextSnapshotMock(string content, ITextBuffer textBuffer, TextVersionMock version) {
            TextProvider = new TextStream(content);
            TextBuffer = textBuffer;
            _lines = MakeLines(content);
            _version = version;

            Change = new TextChangeMock();
        }
예제 #5
0
        public TextVersionMock(ITextBuffer textBuffer, int version, int length)
        {
            TextBuffer              = textBuffer;
            VersionNumber           = version;
            ReiteratedVersionNumber = version;
            Length = length;

            _change = new TextChangeMock();
        }
예제 #6
0
        public TextSnapshotMock(string content, ITextBuffer textBuffer, TextVersionMock version)
        {
            TextProvider = new TextStream(content);
            TextBuffer   = textBuffer;
            _lines       = MakeLines(content);
            _version     = version;

            Change = new TextChangeMock();
        }
예제 #7
0
        public TextVersionMock CreateNextVersion(TextChangeMock change)
        {
            _change = change;
            TextVersionMock nextVersion = new TextVersionMock(TextBuffer, VersionNumber + 1, Length + _change.Delta);

            Next = nextVersion;

            return nextVersion;
        }
예제 #8
0
        public TextVersionMock(ITextBuffer textBuffer, int version, int length)
        {
            TextBuffer = textBuffer;
            VersionNumber = version;
            ReiteratedVersionNumber = version;
            Length = length;

            _change = new TextChangeMock();
         }
예제 #9
0
        public ITextSnapshot Delete(Span deleteSpan)
        {
            var sb = new StringBuilder();
            var oldText = CurrentSnapshot.GetText(deleteSpan.Start, deleteSpan.Length);

            sb.Append(CurrentSnapshot.GetText(0, deleteSpan.Start));
            sb.Append(CurrentSnapshot.GetText(deleteSpan.End, CurrentSnapshot.Length - deleteSpan.End));

            TextChangeMock change = new TextChangeMock(deleteSpan.Start, deleteSpan.Length, oldText, String.Empty);
            TextSnapshotMock nextSnapshot = ((TextSnapshotMock)CurrentSnapshot).CreateNextSnapshot(sb.ToString(), change);

            ApplyChange(nextSnapshot);

            return CurrentSnapshot;
        }
예제 #10
0
        public ITextSnapshot Insert(int position, string text)
        {
            var sb = new StringBuilder();

            sb.Append(CurrentSnapshot.GetText(0, position));
            sb.Append(text);
            sb.Append(CurrentSnapshot.GetText(position, CurrentSnapshot.Length - position));

            var change       = new TextChangeMock(position, 0, String.Empty, text);
            var nextSnapshot = ((TextSnapshotMock)CurrentSnapshot).CreateNextSnapshot(sb.ToString(), change);

            ApplyChange(nextSnapshot);

            return(CurrentSnapshot);
        }
예제 #11
0
        public ITextSnapshot Delete(Span deleteSpan)
        {
            var sb      = new StringBuilder();
            var oldText = CurrentSnapshot.GetText(deleteSpan.Start, deleteSpan.Length);

            sb.Append(CurrentSnapshot.GetText(0, deleteSpan.Start));
            sb.Append(CurrentSnapshot.GetText(deleteSpan.End, CurrentSnapshot.Length - deleteSpan.End));

            TextChangeMock   change       = new TextChangeMock(deleteSpan.Start, deleteSpan.Length, oldText, String.Empty);
            TextSnapshotMock nextSnapshot = ((TextSnapshotMock)CurrentSnapshot).CreateNextSnapshot(sb.ToString(), change);

            ApplyChange(nextSnapshot);

            return(CurrentSnapshot);
        }
예제 #12
0
        public ITextSnapshot Replace(Span replaceSpan, string replaceWith)
        {
            var sb      = new StringBuilder();
            var oldText = CurrentSnapshot.GetText(replaceSpan);

            sb.Append(CurrentSnapshot.GetText(0, replaceSpan.Start));
            sb.Append(replaceWith);
            sb.Append(CurrentSnapshot.GetText(replaceSpan.End, CurrentSnapshot.Length - replaceSpan.End));

            var change = new TextChangeMock(replaceSpan.Start, replaceSpan.Length, oldText, replaceWith);

            var nextSnapshot = ((TextSnapshotMock)CurrentSnapshot).CreateNextSnapshot(sb.ToString(), change);

            ApplyChange(nextSnapshot);

            return(CurrentSnapshot);
        }
예제 #13
0
        public ITextSnapshot Insert(int position, string text)
        {
            var sb = new StringBuilder();

            sb.Append(CurrentSnapshot.GetText(0, position));
            sb.Append(text);
            sb.Append(CurrentSnapshot.GetText(position, CurrentSnapshot.Length - position));

            TextChangeMock change = new TextChangeMock(position, 0, String.Empty, text);
            TextSnapshotMock nextSnapshot = ((TextSnapshotMock)CurrentSnapshot).CreateNextSnapshot(sb.ToString(), change);

            ApplyChange(nextSnapshot);

            return CurrentSnapshot;
        }
예제 #14
0
        public ITextSnapshot Replace(Span replaceSpan, string replaceWith)
        {
            var sb = new StringBuilder();
            var oldText = CurrentSnapshot.GetText(replaceSpan);

            sb.Append(CurrentSnapshot.GetText(0, replaceSpan.Start));
            sb.Append(replaceWith);
            sb.Append(CurrentSnapshot.GetText(replaceSpan.End, CurrentSnapshot.Length - replaceSpan.End));

            TextChangeMock change = new TextChangeMock(replaceSpan.Start, replaceSpan.Length, oldText, replaceWith);

            TextSnapshotMock nextSnapshot = ((TextSnapshotMock)CurrentSnapshot).CreateNextSnapshot(sb.ToString(), change);
            ApplyChange(nextSnapshot);

            return CurrentSnapshot;
        }
 public TextChangeCollectionMock(TextChangeMock change)
 {
     _change = change;
 }
예제 #16
0
 public TextChangeCollectionMock(TextChangeMock change)
 {
     _change = change;
 }