Beispiel #1
0
        public void TestLogicalToVisualLine()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[0
+[1
2
]3
4
+[5
+[6
+[7
8
]9
]10
]11
]12
13
+[14
15
]16
17";
            document.UpdateFoldSegments(GetFoldSegments(document), false);
            Assert.AreEqual(13, document.VisualToLogicalLine(5));
            Assert.AreEqual(18, document.VisualToLogicalLine(8));
        }
        public void TestLogicalToVisualLine()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[0
+[1
2
]3
4
+[5
+[6
+[7
8
]9
]10
]11
]12
13
+[14
15
]16
17";
            document.UpdateFoldSegments(GetFoldSegments(document));
            do
            {
                Gtk.Application.RunIteration();
            } while (!document.HasFoldSegments);
            Assert.AreEqual(12, document.VisualToLogicalLine(4));
            Assert.AreEqual(17, document.VisualToLogicalLine(7));
        }
Beispiel #3
0
        public void TestVisualToLogicalLineCase2()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[1
+[2
3
]4
5
+[6
+[7
+[8
9
]10
]11
]12
]13
14
+[15
16
]17
18";
            document.UpdateFoldSegments(GetFoldSegments(document), false);
            Assert.AreEqual(6, document.VisualToLogicalLine(4));
            Assert.AreEqual(14, document.VisualToLogicalLine(6));
            Assert.AreEqual(15, document.VisualToLogicalLine(7));
        }
Beispiel #4
0
        public void TestUpdateFoldSegmentBug2()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[0
1
+[2
3]
4
+[5
6]
7
8
9
10
11
12
13]
14
15";
            var segments = GetFoldSegments(document);

            document.UpdateFoldSegments(segments, false);
            Assert.AreEqual(10, document.VisualToLogicalLine(8));
            int start = document.GetLine(2).Offset;
            int end   = document.GetLine(8).Offset;

            ((IBuffer)document).Remove(start, end - start);
            Assert.AreEqual(10, document.LogicalToVisualLine(10));
        }
Beispiel #5
0
        public void TestUpdateFoldSegmentBug2()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[1
2
+[3
4]
5
+[6
7]
8
9
10
11
12
13
14]
15
16";
            var segments = GetFoldSegments(document);

            document.UpdateFoldSegments(segments, false);
            Assert.AreEqual(10, document.VisualToLogicalLine(8));
            Assert.AreEqual(3, document.FoldSegments.Count());
            int start = document.GetLine(2).Offset;
            int end   = document.GetLine(8).Offset;

            ((IBuffer)document).Remove(start, end - start);
            Assert.AreEqual(1, document.FoldSegments.Count());
            Assert.AreEqual(10, document.LogicalToVisualLine(10));
        }
Beispiel #6
0
        public void TestVisualToLogicalLineStartLine()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[1
-[2
3
]4
5
-[6
+[7
-[8
9
]10
]11
]12
]13
14
-[15
16
]17
18";
            document.UpdateFoldSegments(GetFoldSegments(document), false);
            Assert.AreEqual(7, document.VisualToLogicalLine(7));
        }
Beispiel #7
0
        public void TestUpdateFoldSegmentBug()
        {
            Document document = new Mono.TextEditor.Document();

            document.Text =
                @"-[0
1
+[2
3
4
5
6
7
8
9
10]
11
]12
13
+[14
15
16
17
18
19
20
21
22]
23
24
25
26";
            var segments = GetFoldSegments(document);

            document.UpdateFoldSegments(segments, false);
            Assert.AreEqual(25, document.VisualToLogicalLine(9));
            Assert.AreEqual(3, document.FoldSegments.Count());
            segments.RemoveAt(1);


            document.UpdateFoldSegments(segments, false);

            Assert.AreEqual(2, document.FoldSegments.Count());
            Assert.AreEqual(17, document.LogicalToVisualLine(25));
            segments.RemoveAt(1);
            document.UpdateFoldSegments(segments, false);
            Assert.AreEqual(1, document.FoldSegments.Count());
            Assert.AreEqual(25, document.LogicalToVisualLine(25));
        }
Beispiel #8
0
		public void TestUpdateFoldSegmentBug2 ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[0
1
+[2
3]
4
+[5
6]
7
8
9
10
11
12
13]
14
15";
			var segments = GetFoldSegments (document);
			document.UpdateFoldSegments (segments, false);
			Assert.AreEqual (10, document.VisualToLogicalLine (8));
			int start = document.GetLine (2).Offset;
			int end = document.GetLine (8).Offset;
			((IBuffer)document).Remove (start, end - start);
			Assert.AreEqual (10, document.LogicalToVisualLine (10));
		}
Beispiel #9
0
		public void TestLogicalToVisualLine ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[0
+[1
2
]3
4
+[5
+[6
+[7
8
]9
]10
]11
]12
13
+[14
15
]16
17";
			document.UpdateFoldSegments (GetFoldSegments (document), false);
			Assert.AreEqual (13, document.VisualToLogicalLine (5));
			Assert.AreEqual (18, document.VisualToLogicalLine (8));
		}
Beispiel #10
0
		public void TestUpdateFoldSegmentBug ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[0
1
+[2
3
4
5
6
7
8
9
10]
11
]12
13
+[14
15
16
17
18
19
20
21
22]
23
24
25
26";
			var segments = GetFoldSegments (document);
			document.UpdateFoldSegments (segments, false);
			Assert.AreEqual (25, document.VisualToLogicalLine (9));
			segments.RemoveAt (1);
			
			document.UpdateFoldSegments (segments, false);
			
			Assert.AreEqual (17, document.LogicalToVisualLine (25));
			segments.RemoveAt (1);
			document.UpdateFoldSegments (segments, false);
			Assert.AreEqual (25, document.LogicalToVisualLine (25));
		}
Beispiel #11
0
		public void TestLogicalToVisualLine ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[0
+[1
2
]3
4
+[5
+[6
+[7
8
]9
]10
]11
]12
13
+[14
15
]16
17";
			document.UpdateFoldSegments (GetFoldSegments (document));
			do {
				Gtk.Application.RunIteration ();
			} while (!document.HasFoldSegments);
			Assert.AreEqual (13, document.VisualToLogicalLine (5));
			Assert.AreEqual (18, document.VisualToLogicalLine (8));
		}
		public void TestUpdateFoldSegmentBug2 ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[1
2
+[3
4]
5
+[6
7]
8
9
10
11
12
13
14]
15
16";
			var segments = GetFoldSegments (document);
			document.UpdateFoldSegments (segments, false);
			Assert.AreEqual (10, document.VisualToLogicalLine (8));
			Assert.AreEqual (3, document.FoldSegments.Count ());
			int start = document.GetLine (2).Offset;
			int end = document.GetLine (8).Offset;
			((IBuffer)document).Remove (start, end - start);
			Assert.AreEqual (1, document.FoldSegments.Count ());
			Assert.AreEqual (10, document.LogicalToVisualLine (10));
		}
		public void TestVisualToLogicalLineCase3 ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[1
+[2
3
]4
5
+[6
+[7
+[8
9
]10
]11
]12
]13
14
+[15
16
]17
18";
			document.UpdateFoldSegments (GetFoldSegments (document), false);
			Assert.AreEqual (2, document.VisualToLogicalLine (2));
			Assert.AreEqual (2, document.LogicalToVisualLine (2));
		}
		public void TestVisualToLogicalLineStartLine ()
		{
			Document document = new Mono.TextEditor.Document ();
			document.Text = 
@"-[1
-[2
3
]4
5
-[6
+[7
-[8
9
]10
]11
]12
]13
14
-[15
16
]17
18";
			document.UpdateFoldSegments (GetFoldSegments (document), false);
			Assert.AreEqual (7, document.VisualToLogicalLine (7));
		}