public void TestBug15335() { var data = Create("namespace Foo\n{\n\tpublic class Bar\n\t{\n\t\tvoid Test()\r\n\t\t{\r\n\t\t\t/* foo$\n\t\t}\n\t}\n}\n"); MiscActions.InsertNewLine(data); CheckOutput(data, "namespace Foo\n{\n\tpublic class Bar\n\t{\n\t\tvoid Test()\r\n\t\t{\r\n\t\t\t/* foo\n\t\t\t * $\n\t\t}\n\t}\n}\n"); }
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 TestMultiLineCommentContinuation() { var data = Create("\t\t/*$" + eolMarker + "\t\tclass Foo {}"); MiscActions.InsertNewLine(data); CheckOutput(data, "\t\t/*" + eolMarker + "\t\t * $" + eolMarker + "\t\tclass Foo {}"); }
public void TestEnterSelectionBehavior() { var data = Create("\tfirst\n<-\tsecond\n->$\tthird"); MiscActions.InsertNewLine(data); CheckOutput(data, "\tfirst\n\t$third"); }
public void TestStringContination() { var data = Create("\t\t\"Hello$ World\""); MiscActions.InsertNewLine(data); CheckOutput(data, "\t\t\"Hello\" +" + eolMarker + "\t\t\"$World\""); }
public void TestIndentWithSpaces() { var data = CreateDataWithSpaces("\n \n\n"); data.Caret.Location = new DocumentLocation(2, 9); MiscActions.InsertNewLine(data); Assert.AreEqual("\n\n\n\n", data.Document.Text); }
public void TestBug3214() { var data = Create("\"Hello\n\t$"); MiscActions.InsertNewLine(data); CheckOutput(data, "\"Hello\n\t" + eolMarker + "\t$"); }
public void TestBug11966() { var data = Create("///<summary>This is a long comment $ </summary>"); MiscActions.InsertNewLine(data); CheckOutput(data, @"///<summary>This is a long comment /// $ </summary>"); }
public void TestGotoMatchingBracket() { var data = Create("$(foo(bar))"); MiscActions.GotoMatchingBracket(data); Check(data, "(foo(bar)$)"); MiscActions.GotoMatchingBracket(data); Check(data, "$(foo(bar))"); }
protected override void Run() { for (int i = 0; i < Count; i++) { MiscActions.Undo(Editor); } Editor.ClearSelection(); }
protected override void Run() { for (int i = 0; i < Count; i++) { MiscActions.RemoveIndentSelection(Editor); } RequestedMode = Mode.Normal; }
public void TestReturnOnNonEmptyLine() { var data = CreateData("\n\t\tFoo\t\tBar\n\n"); data.Caret.Location = new DocumentLocation(2, 3); MiscActions.InsertNewLine(data); Assert.AreEqual(3, data.Caret.Column); Assert.AreEqual("\n\n\t\tFoo\t\tBar\n\n", data.Document.Text); }
public void TestBug4839 () { var editor = Create ("1\n2\n3\n4\n5\n6\n7"); editor.Caret.Offset = editor.Text.Length; var heightTree = new HeightTree (editor); heightTree.Rebuild (); MiscActions.InsertNewLine (editor); Assert.AreEqual ((editor.LineCount - 1) * editor.LineHeight, heightTree.LineNumberToY (editor.LineCount)); }
public void TestIssue5279() { var data = CreateData("\n\n\n"); data.IndentationTracker = new SmartIndentModeTests.TestIndentTracker(); data.Caret.Location = new DocumentLocation(2, 3); MiscActions.RemoveTab(data); Assert.AreEqual("\n\t\n\n", data.Document.Text); }
public void TestVSTS801783() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.IndentationTracker = new SmartIndentModeTests.TestIndentTracker(" "); data.Document.Text = "HelloWorld!"; data.Caret.Location = new DocumentLocation(1, "Hello".Length); MiscActions.InsertNewLine(data); Assert.AreEqual(4, data.Caret.Column); }
public void TestSwitchCaretMode() { var data = Create("foo$bar"); Assert.IsTrue(data.Caret.IsInInsertMode); MiscActions.SwitchCaretMode(data); Assert.IsFalse(data.Caret.IsInInsertMode); MiscActions.SwitchCaretMode(data); Assert.IsTrue(data.Caret.IsInInsertMode); }
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 TestUndo() { // Undo/Redo subsystem is tested separately, this only checks if the action is working. var data = Create("foo$"); data.InsertAtCaret("bar"); Check(data, "foobar$"); MiscActions.Undo(data); Check(data, "foo$"); }
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); }
public void TestAutoRemoveExistingIndentOnReturn() { var data = CreateData("\n\t\t\n\n"); data.Caret.Location = new DocumentLocation(2, 3); MiscActions.InsertNewLine(data); MiscActions.InsertNewLine(data); Assert.AreEqual(3, data.Caret.Column); Assert.AreEqual("\n\n\n\n\n", data.Document.Text); }
public void TestIndentNewLine() { var data = CreateData("\n\n\n"); data.Caret.Offset = data.Document.GetLine(2).Offset; MiscActions.InsertNewLine(data); Assert.AreEqual("\n\n\n\n", data.Document.Text); Assert.AreEqual(data.GetVirtualIndentationColumn(2, 1), data.Caret.Column); }
public void TestIndentNewLine() { var data = CreateData("\n\n\n"); data.Caret.Offset = data.Document.GetLine(2).Offset; MiscActions.InsertNewLine(data); Assert.AreEqual("\n\n\t\t\n\n", data.Document.Text); Assert.AreEqual(data.Document.GetLine(3).Offset + 2, data.Caret.Offset); }
public void TestBug53878() { var data = CreateData(" FooBar\n Foo {}"); data.Caret.Offset = data.Document.GetLine(2).EndOffset - 1; data.Options.IndentStyle = IndentStyle.Auto; MiscActions.InsertNewLine(data); Assert.AreEqual(" FooBar\n Foo {\n }", data.Document.Text); Assert.AreEqual(data.Document.GetLine(3).EndOffset - 1, data.Caret.Offset); }
/// <summary> /// The Redo menu item handler /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> private void OnRedo(object sender, EventArgs e) { try { MiscActions.Redo(textEditor.TextArea.GetTextEditorData()); } catch (Exception err) { ShowError(err); } }
public void TestStringContination() { var data = Create("\t\t\"Hello$World\""); MiscActions.InsertNewLine(data); var engine = new CSharpTextEditorIndentation { wasInStringLiteral = true }; CheckOutput(data, "\t\t\"Hello\" +" + eolMarker + "\t\t\"$World\"", engine); }
public void TestBug615196_UnIndentCase() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = "\n\t\t\n\t\t\n\t\t\n\n"; data.Caret.Offset = data.Document.GetLine(2).Offset; // 2nd.Line data.MainSelection = new Selection(2, 1, 4, 1); MiscActions.RemoveTab(data); MiscActions.RemoveTab(data); Assert.AreEqual("\n\n\n\t\t\n\n", data.Document.Text); }
public void TestBug17896() { var data = Create("\t\t\"This is a long test string.$ It contains spaces.\""); MiscActions.InsertNewLine(data); var engine = new CSharpTextEditorIndentation { wasInStringLiteral = true }; CheckOutput(data, "\t\t\"This is a long test string.\" +" + eolMarker + "\t\t\"$ It contains spaces.\"", engine); }
public void TestInsertNewLine() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = "Hello World!"; data.Caret.Location = new DocumentLocation(1, "Hello".Length + 1); MiscActions.InsertNewLine(data); Assert.AreEqual(2, data.Document.LineCount); Assert.AreEqual(2, data.Caret.Line); Assert.AreEqual(1, data.Caret.Column); Assert.AreEqual("Hello" + Environment.NewLine + " World!", data.Document.Text); }
public void TestReturnKeyBehavior() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Options.IndentStyle = IndentStyle.Auto; data.Document.Text = "\n\n\n"; data.Caret.Offset = 1; // 2nd.Line data.Caret.AllowCaretBehindLineEnd = true; data.Caret.Column = DocumentLocation.MinColumn + 4; MiscActions.InsertNewLine(data); Assert.AreEqual("\n \n \n\n", data.Document.Text); }
public void TestXmlDocumentContinuationCase2() { var data = Create("\t\t///" + eolMarker + "\t\t/// Hel$lo" + eolMarker + "\t\tclass Foo {}"); MiscActions.InsertNewLine(data); CheckOutput(data, "\t\t///" + eolMarker + "\t\t/// Hel" + eolMarker + "\t\t/// $lo" + eolMarker + "\t\tclass Foo {}"); }