public TextSnapshotMock CreateNextSnapshot(string content, TextChangeMock change) { Change = change; var nextVersion = _version.CreateNextVersion(change); return(new TextSnapshotMock(content, TextBuffer, nextVersion)); }
public TextSnapshotMock CreateNextSnapshot(string content, TextChangeMock change) { Change = change; TextVersionMock nextVersion = _version.CreateNextVersion(change); TextSnapshotMock nextSnapshot = new TextSnapshotMock(content, TextBuffer, nextVersion); return nextSnapshot; }
public TextVersionMock CreateNextVersion(TextChangeMock change) { _change = change; var nextVersion = new TextVersionMock(TextBuffer, VersionNumber + 1, Length + _change.Delta); Next = nextVersion; return(nextVersion); }
public TextSnapshotMock(string content, ITextBuffer textBuffer, TextVersionMock version) { TextProvider = new TextStream(content); TextBuffer = textBuffer; _lines = MakeLines(content); _version = version; Change = new TextChangeMock(); }
public TextVersionMock(ITextBuffer textBuffer, int version, int length) { TextBuffer = textBuffer; VersionNumber = version; ReiteratedVersionNumber = version; Length = length; _change = new TextChangeMock(); }
public TextVersionMock CreateNextVersion(TextChangeMock change) { _change = change; TextVersionMock nextVersion = new TextVersionMock(TextBuffer, VersionNumber + 1, Length + _change.Delta); Next = nextVersion; return nextVersion; }
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; }
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); }
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); }
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); }
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; }
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; }