public void TestPasteBlockSelection() { var data = Create( @"1234567890 1234<-567890 1234567890 1234567890 1234->$567890 1234567890"); data.MainSelection = data.MainSelection.WithSelectionMode(SelectionMode.Block); Clipboard clipboard = Clipboard.Get(Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM); clipboard.Text = "hello"; ClipboardActions.Paste(data); Check(data, @"1234567890 1234hello567890 1234hello567890 1234hello567890 1234hello$567890 1234567890"); }
/// <summary> /// The Past menu item handler /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> private void OnPaste(object sender, EventArgs e) { try { ClipboardActions.Paste(textEditor.TextArea.GetTextEditorData()); } catch (Exception err) { ShowError(err); } }
public void TestPasteDoesntInsertVirtualIndent() { var data = VirtualIndentModeTests.CreateData(""); data.Caret.Location = new DocumentLocation(1, data.IndentationTracker.GetVirtualIndentationColumn(1, 1)); var clipboard = Clipboard.Get(Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM); clipboard.Text = "\n\n"; ClipboardActions.Paste(data); Assert.AreEqual("\n\n", data.Document.Text); }
public void TestTextPasteHandler() { var data = Create( @"$"); Clipboard clipboard = Clipboard.Get(Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM); clipboard.Text = "hello"; data.TextPasteHandler = this; ClipboardActions.Paste(data); Check(data, @"Hello World$"); }
public void TestBug615196() { TextEditorData data = new Mono.TextEditor.TextEditorData(); data.Document.Text = "\n\nHello World\n"; data.Caret.Offset = 1; // 2nd.Line data.Caret.AllowCaretBehindLineEnd = true; data.Caret.Column = DocumentLocation.MinColumn + 4; Clipboard clipboard = Clipboard.Get(Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM); clipboard.Text = "Test"; ClipboardActions.Paste(data); Assert.AreEqual("\n Test\nHello World\n", data.Document.Text); }
public void TestBug7012() { var data = CreateData("\n\t\tthrow new NotImplementedException();"); var loc1 = new DocumentLocation(1, data.IndentationTracker.GetVirtualIndentationColumn(1, 1)); var loc2 = new DocumentLocation(3, data.GetLine(2).Length); data.Caret.Location = loc2; data.SetSelection(loc1, loc2); var clipboard = Clipboard.Get(Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM); clipboard.Text = "Console.WriteLine(\"Hello\");"; ClipboardActions.Paste(data); Assert.AreEqual("\t\tConsole.WriteLine(\"Hello\");", data.Document.Text); }
public void TestUndoSteps_WithoutFormattingStep() { var data = Create( @"$"); data.Options.GenerateFormattingUndoStep = false; Clipboard clipboard = Clipboard.Get(Mono.TextEditor.ClipboardActions.CopyOperation.CLIPBOARD_ATOM); clipboard.Text = "hello"; data.TextPasteHandler = this; ClipboardActions.Paste(data); Check(data, @"Hello World$"); MiscActions.Undo(data); Check(data, @"$"); }
/// <summary> /// The Past menu item handler /// </summary> /// <param name="sender">The sending object</param> /// <param name="e">The event arguments</param> private void OnPaste(object sender, EventArgs e) { ClipboardActions.Paste(textEditor.TextArea.GetTextEditorData()); }