Forum > Editor

inserting text from clipboard after cursor position

(1/1)

Чебурашка:
Normally when doing ctrl+v, text from clipboard is pasted starting from cursor position, but at the end the cursor position gets moved at the end of the pasted content.

Is there a way to paste the text stored in clipboard after the cursor, without cursor position to be modified at all?

Martin_fr:
If you just want to insert it into multiple lines, maybe multi cursor can help https://wiki.lazarus.freepascal.org/New_IDE_features_since#Multi_Caret

Otherwise, you can record an editor macro
https://wiki.freepascal.org/IDE_Window:_Editor_Macros
https://wiki.freepascal.org/Editor_Macros_PascalScript

The easiest is to record a macro, using a bookmark (but then it will unset the bookmark if you already used it somewhere else.
- Start recording
- set bookmark 1
- paste
- go to bookmark 1

A bit more involved would be a pascal script macro.
Record a macro, press any key, then open the macro list window, and edit the macro you recorded

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Caller.InsertTextAtCaret(ClipBoard.AsText, scamBegin);
Move that new macro to "IDE" so it will be kept when you close the IDE.

Navigation

[0] Message Index

Go to full version