public void TestLastLineRemove () { IBuffer buffer = new Mono.TextEditor.GapBuffer (); LineSplitter splitter = new Mono.TextEditor.LineSplitter (); buffer.Text = "1\n2\n3\n"; splitter.TextReplaced (null, new DocumentChangeEventArgs (0, "", buffer.Text)); LineSegment lastLine = splitter.Get (2); splitter.TextReplaced (null, new DocumentChangeEventArgs (lastLine.Offset, buffer.GetTextAt (lastLine.Offset, lastLine.LengthIncludingDelimiter), "")); Assert.AreEqual (3, splitter.Count); Assert.AreEqual (2 * 2, splitter.Get (3).Offset); Assert.AreEqual (0, splitter.Get (3).Length); Assert.AreEqual (0, splitter.Get (3).DelimiterLength); Assert.AreEqual (0, splitter.Get (3).LengthIncludingDelimiter); }
public void TestLastLineRemove() { IBuffer buffer = new Mono.TextEditor.GapBuffer(); LineSplitter splitter = new Mono.TextEditor.LineSplitter(); buffer.Text = "1\n2\n3\n"; splitter.TextReplaced(null, new DocumentChangeEventArgs(0, "", buffer.Text)); DocumentLine lastLine = splitter.Get(2); splitter.TextReplaced(null, new DocumentChangeEventArgs(lastLine.Offset, buffer.GetTextAt(lastLine.Offset, lastLine.LengthIncludingDelimiter), "")); Assert.AreEqual(3, splitter.Count); Assert.AreEqual(2 * 2, splitter.Get(3).Offset); Assert.AreEqual(0, splitter.Get(3).Length); Assert.AreEqual(0, splitter.Get(3).DelimiterLength); Assert.AreEqual(0, splitter.Get(3).LengthIncludingDelimiter); }