public void TestLastLineRemove ()
		{
			IBuffer buffer = new Mono.TextEditor.GapBuffer ();
			LineSplitter splitter = new Mono.TextEditor.LineSplitter (buffer);
			buffer.Text = "1\n2\n3\n";
			splitter.TextReplaced (null, new ReplaceEventArgs (0, 0, buffer.Text));
			
			LineSegment lastLine = splitter.Get (2);
			splitter.TextReplaced (null, new ReplaceEventArgs (lastLine.Offset, lastLine.Length, ""));
			
			Assert.AreEqual (3, splitter.LineCount);
			
			Assert.AreEqual (2 * 2, splitter.Get (2).Offset);
			Assert.AreEqual (0, splitter.Get (2).EditableLength);
			Assert.AreEqual (0, splitter.Get (2).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (2).Length);
		}
Пример #2
0
		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);
		}
Пример #3
0
		public void TestLastLineCreation ()
		{
			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));
			Assert.AreEqual (4, splitter.Count);
			for (int i = 0; i < 3; i++) {
				Assert.AreEqual (i * 2, splitter.Get (i + 1).Offset);
				Assert.AreEqual (1, splitter.Get (i + 1).Length);
				Assert.AreEqual (1, splitter.Get (i + 1).DelimiterLength);
				Assert.AreEqual (2, splitter.Get (i + 1).LengthIncludingDelimiter);
			}
			Assert.AreEqual (3 * 2, splitter.Get (4).Offset);
			Assert.AreEqual (0, splitter.Get (4).Length);
			Assert.AreEqual (0, splitter.Get (4).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (4).LengthIncludingDelimiter);
		}
		public void TestLastLineCreation ()
		{
			IBuffer buffer = new Mono.TextEditor.GapBuffer ();
			LineSplitter splitter = new Mono.TextEditor.LineSplitter (buffer);
			buffer.Text = "1\n2\n3\n";
			splitter.TextReplaced (null, new ReplaceEventArgs (0, 0, buffer.Text));
			Assert.AreEqual (4, splitter.LineCount);
			for (int i = 0; i < 3; i++) {
				Assert.AreEqual (i * 2, splitter.Get (i).Offset);
				Assert.AreEqual (1, splitter.Get (i).EditableLength);
				Assert.AreEqual (1, splitter.Get (i).DelimiterLength);
				Assert.AreEqual (2, splitter.Get (i).Length);
			}
			Assert.AreEqual (3 * 2, splitter.Get (3).Offset);
			Assert.AreEqual (0, splitter.Get (3).EditableLength);
			Assert.AreEqual (0, splitter.Get (3).DelimiterLength);
			Assert.AreEqual (0, splitter.Get (3).Length);
		}
Пример #5
0
        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 ReplaceEventArgs(0, 0, buffer.Text));

            LineSegment lastLine = splitter.Get(2);

            splitter.TextReplaced(null, new ReplaceEventArgs(lastLine.Offset, lastLine.Length, ""));

            Assert.AreEqual(3, splitter.Count);

            Assert.AreEqual(2 * 2, splitter.Get(3).Offset);
            Assert.AreEqual(0, splitter.Get(3).EditableLength);
            Assert.AreEqual(0, splitter.Get(3).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(3).Length);
        }
Пример #6
0
        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);
        }
Пример #7
0
        public void TestLastLineCreation()
        {
            IBuffer      buffer   = new Mono.TextEditor.GapBuffer();
            LineSplitter splitter = new Mono.TextEditor.LineSplitter();

            buffer.Text = "1\n2\n3\n";
            splitter.TextReplaced(null, new ReplaceEventArgs(0, 0, buffer.Text));
            Assert.AreEqual(4, splitter.Count);
            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(i * 2, splitter.Get(i + 1).Offset);
                Assert.AreEqual(1, splitter.Get(i + 1).EditableLength);
                Assert.AreEqual(1, splitter.Get(i + 1).DelimiterLength);
                Assert.AreEqual(2, splitter.Get(i + 1).Length);
            }
            Assert.AreEqual(3 * 2, splitter.Get(4).Offset);
            Assert.AreEqual(0, splitter.Get(4).EditableLength);
            Assert.AreEqual(0, splitter.Get(4).DelimiterLength);
            Assert.AreEqual(0, splitter.Get(4).Length);
        }