public void Action(TextEditorData data) { if (!editor.DoInsertTemplate()) { MiscActions.InsertTab(data); } }
public void TestInsertTabLineReverse() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = @"123456789 123[456789 123d456789 123]456789 123456789 123456789"; SetSelection(data, true); MiscActions.InsertTab(data); /* ISegment currentSelection = GetSelection (data, true); * * Assert.AreEqual (currentSelection.Offset, data.SelectionRange.Offset); * Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset); * Assert.AreEqual (currentSelection.Offset, data.Caret.Offset);*/ Assert.IsTrue(data.Document.GetLine(1).Length > data.Document.GetLine(0).Length); Assert.IsTrue(data.Document.GetLine(2).Length > data.Document.GetLine(0).Length); Assert.IsTrue(data.Document.GetLine(3).Length > data.Document.GetLine(0).Length); Assert.AreEqual(data.Document.GetLine(0).Length, data.Document.GetLine(4).Length); Assert.AreEqual(data.Document.GetLine(1).Length, data.Document.GetLine(2).Length); Assert.AreEqual(data.Document.GetLine(1).Length, data.Document.GetLine(3).Length); }
public void TestInsertTabLineCase4() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = @"123d456789 [123456789 123d456789 123]456789 123456789 123456789"; SetSelection(data, false); MiscActions.InsertTab(data); /* ISegment currentSelection = GetSelection (data, false); * * Assert.AreEqual (currentSelection.EndOffset, data.SelectionRange.EndOffset); * Assert.AreEqual (currentSelection.EndOffset, data.Caret.Offset);*/ Assert.AreEqual(data.Document.GetLine(DocumentLocation.MinLine + 1).Offset, data.SelectionRange.Offset); Assert.IsTrue(data.Document.GetLine(DocumentLocation.MinLine + 1).Length > data.Document.GetLine(DocumentLocation.MinLine + 0).Length); Assert.IsTrue(data.Document.GetLine(DocumentLocation.MinLine + 2).Length > data.Document.GetLine(DocumentLocation.MinLine + 0).Length); Assert.IsTrue(data.Document.GetLine(DocumentLocation.MinLine + 3).Length > data.Document.GetLine(DocumentLocation.MinLine + 0).Length); Assert.AreEqual(data.Document.GetLine(DocumentLocation.MinLine + 1).Length, data.Document.GetLine(DocumentLocation.MinLine + 2).Length); }
public void TestTabBehavior() { var data = CreateData("\n\n\n"); data.Caret.Location = new DocumentLocation(2, 3); MiscActions.InsertTab(data); Assert.AreEqual("\n\t\t\t\n\n", data.Document.Text); }
public void TestBug1700() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = "123\n123\n123"; data.MainSelection = new Selection(1, 2, 3, 2, SelectionMode.Block); MiscActions.InsertTab(data); Assert.AreEqual("1\t23\n1\t23\n1\t23", data.Document.Text); }
private void IndentCaretInBlock(int openingChar) { string indentation = Editor.GetLineIndent(Editor.OffsetToLineNumber(openingChar)); if (indentation != null && indentation.Length > 0) { Editor.Insert(Editor.Caret.Offset, indentation); } MiscActions.InsertTab(Editor); }
public void TestBug615196_IndentCase() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = "\n\n\n\n\n"; data.Caret.Offset = data.Document.GetLine(2).Offset; // 2nd.Line data.MainSelection = new Selection(2, 1, 4, 1); MiscActions.InsertTab(data); MiscActions.InsertTab(data); Assert.AreEqual("\n\t\t\n\t\t\n\n\n", data.Document.Text); }
public void TestInsertTabLineCase2(bool reverse) { var data = Create(@"123d456789 123[456789 123d456789 ]123456789 123456789 123456789", reverse); MiscActions.InsertTab(data); Check(data, @"123d456789 123[456789 123d456789 ]123456789 123456789 123456789", reverse); }
public void TestBug5223() { var data = Create(@" 123d456789 123$<-456789 123d456789 ->123456789 123456789 123456789", new TextEditorOptions() { TabsToSpaces = true }); MiscActions.InsertTab(data); Check(data, @" 123d456789 123$<-456789 123d456789 ->123456789 123456789 123456789"); }
public void TestBug5724() { var data = Create( @"1234567890 1234<-567890 1234567890 1234567890 123456->$7890 1234567890"); data.MainSelection = data.MainSelection.WithSelectionMode(SelectionMode.Block); MiscActions.InsertTab(data); Check(data, @"1234567890 1234 <-7890 1234 7890 1234 7890 1234 ->$7890 1234567890"); }
public void TestBug5373() { var data = Create(@" 123d456789 123$<-456789 123d456789 ->123456789" , new TextEditorOptions() { IndentStyle = IndentStyle.Virtual }); data.IndentationTracker = SmartIndentModeTests.IndentTracker; MiscActions.InsertTab(data); Check(data, @" 123d456789 123$<-456789 123d456789 ->123456789" ); }