Author Topic: inserting text from clipboard after cursor position  (Read 489 times)


  • Hero Member
  • *****
  • Posts: 571
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
inserting text from clipboard after cursor position
« on: December 08, 2023, 01:02:58 am »
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?
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2


  • Administrator
  • Hero Member
  • *
  • Posts: 9880
  • Debugger - SynEdit - and more
    • wiki
Re: inserting text from clipboard after cursor position
« Reply #1 on: December 08, 2023, 01:46:40 am »
If you just want to insert it into multiple lines, maybe multi cursor can help

Otherwise, you can record an editor macro

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  [Select][+][-]
  1. Caller.InsertTextAtCaret(ClipBoard.AsText, scamBegin);

Move that new macro to "IDE" so it will be kept when you close the IDE.


TinyPortal © 2005-2018