コード例 #1
0
        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");
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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 {}");
        }
コード例 #4
0
        public void TestEnterSelectionBehavior()
        {
            var data = Create("\tfirst\n<-\tsecond\n->$\tthird");

            MiscActions.InsertNewLine(data);

            CheckOutput(data, "\tfirst\n\t$third");
        }
コード例 #5
0
        public void TestStringContination()
        {
            var data = Create("\t\t\"Hello$ World\"");

            MiscActions.InsertNewLine(data);

            CheckOutput(data, "\t\t\"Hello\" +" + eolMarker + "\t\t\"$World\"");
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public void TestBug3214()
        {
            var data = Create("\"Hello\n\t$");

            MiscActions.InsertNewLine(data);

            CheckOutput(data, "\"Hello\n\t" + eolMarker + "\t$");
        }
コード例 #8
0
        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>");
        }
コード例 #9
0
        public void TestGotoMatchingBracket()
        {
            var data = Create("$(foo(bar))");

            MiscActions.GotoMatchingBracket(data);
            Check(data, "(foo(bar)$)");
            MiscActions.GotoMatchingBracket(data);
            Check(data, "$(foo(bar))");
        }
コード例 #10
0
        protected override void Run()
        {
            for (int i = 0; i < Count; i++)
            {
                MiscActions.Undo(Editor);
            }

            Editor.ClearSelection();
        }
コード例 #11
0
        protected override void Run()
        {
            for (int i = 0; i < Count; i++)
            {
                MiscActions.RemoveIndentSelection(Editor);
            }

            RequestedMode = Mode.Normal;
        }
コード例 #12
0
        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);
        }
コード例 #13
0
		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));
		}
コード例 #14
0
        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);
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        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);
        }
コード例 #18
0
        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$");
        }
コード例 #19
0
        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);
        }
コード例 #20
0
        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);
        }
コード例 #21
0
        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);
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
ファイル: EditorView.cs プロジェクト: BrianCollinss/ApsimNG
 /// <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);
     }
 }
コード例 #25
0
        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);
        }
コード例 #26
0
ファイル: EditActionsTest.cs プロジェクト: thild/monodevelop
        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);
        }
コード例 #27
0
        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);
        }
コード例 #28
0
        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);
        }
コード例 #29
0
        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 {}");
        }