Recent

Author Topic: Setting Cursor Position After Pasting Clipboard Like Breif keymaping in Delphi  (Read 5310 times)

kyaoga

  • New Member
  • *
  • Posts: 14
  • -[o_o]-

It's not comfortable to paste the clipboard continuously When I use Lazarus to Edit Code.
In Lazarus The cursor will move to The end of block that are paste after pasting the Clipboard.


Is there any setting To set Cursor Position After Pasting Clipboard Like Breif Keymapping in delphi ?


From Example


Here is Code
Code: [Select]
procedure procedure1( IntList : array of int );
begin
  sql.line.add(' SQL_Command Detail 1  _');
  sql.line.add(' SQL_Command Detail 2  _');
  sql.line.add(' SQL_Command Detail 3
  sql.line.add(' SQL_Command Detail 4
  sql.line.add(' SQL_Command Detail 5
  sql.line.add(' SQL_Command Detail 6
  sql.line.add(' SQL_Command Detail 7
  sql.line.add(' SQL_Command Detail 8
end;



1. select Text with Column Selection and copy to Clipboard. The Text you get are


Code: [Select]
_');
_');


2. when you Paste the selected text like these
Code: [Select]
procedure procedure1( IntList : array of int );
begin
  sql.line.add(' SQL_Command Detail 1  _');
  sql.line.add(' SQL_Command Detail 2  _');
  sql.line.add(' SQL_Command Detail 3
  sql.line.add(' SQL_Command Detail 4  <-- Paste at These Column
  sql.line.add(' SQL_Command Detail 5
  sql.line.add(' SQL_Command Detail 6
  sql.line.add(' SQL_Command Detail 7
  sql.line.add(' SQL_Command Detail 8
end;


3. The cursor will move below Paste block 1 row and at Column of begin block  like this
Code: [Select]

procedure procedure1( IntList : array of int );
begin
  sql.line.add(' SQL_Command Detail 1  _');
  sql.line.add(' SQL_Command Detail 2  _');
  sql.line.add(' SQL_Command Detail 3
  sql.line.add(' SQL_Command Detail 4  _');
  sql.line.add(' SQL_Command Detail 5  _');
  sql.line.add(' SQL_Command Detail 6  <-- Here is current position of Cursor
  sql.line.add(' SQL_Command Detail 7
  sql.line.add(' SQL_Command Detail 8
end;




Somebody  Help


Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6821
  • Debugger - SynEdit - and more
    • wiki
Not out of the box. But you can record an Editor macro

start recoding: shift-ctrl-r
set bookmark, paste, go to bookmark, (optional, go one down)

That does of course unset the bookmark from it previous place.

Using 1.1 you can do it in pascal script.

kyaoga

  • New Member
  • *
  • Posts: 14
  • -[o_o]-
Dear Martin_fr,

Quote
  • the latest version is 1.0.8 , right ?
  • In version 1.1 provide this setting like classic or default kepmaps or I have to set this Configs?


thanks
« Last Edit: April 27, 2013, 03:49:22 am by kyaoga »

kyaoga

  • New Member
  • *
  • Posts: 14
  • -[o_o]-
In 1.1 I wish that  provide this keymap like delphi because I have tried many editor providing breif keymap. Their cursor move as pasting block Lazarus but different from delphi.

In delphi , It's automatic and  for pasting block repeatly and wonderful to me for editing Code.


I just only do
  • [press ^c] to begin to select block
  • move cursor to selected in the block
  • [press "+"] to copy block to clipboard
  • [press "Ins"] to paste the copied block,  It's automatic for many block Like this


For Example Code
Code: [Select]
procedure procudeX();
begin
   function1(     );
   function2(     );
   function3(     );
   function4(     );
   function5(     );
   function6(     );
   function7(     );
   function8(     );
   function9(     );
   function10(    );
   function11(    );
   function12(    );
end;
To paste the blocked "ParamX" in same Function

Code: [Select]
procedure procudeX();
begin
   function1(   <-- Move Cursor to this Position
   function2(     );
   function3(     );
   function4(     );
   function5(     );
   function6(     );
   function7(     );
   function8(     );
   function9(     );
   function10(    );
   function11(    );
   function12(    );
end;
Then patse the copied block by pressing "Ins"


!!! Look !!!
After I stop to press "Ins" ,  Code wil be as.
Code: [Select]
procedure procudeX();
begin
   function1(   ParamX );
   function2(   ParamX );
   function3(   ParamX );
   function4(   ParamX );
   function5(   ParamX );
   function6(   ParamX );
   function7(   ParamX );
   function8(   ParamX );
   function9(   ParamX );
   function10(  ParamX );
   function11(  ParamX );
   function12(  ParamX );
end;

It just only pressing "Ins" Only one time not to paste clipboard with pressing the hotkey many time.

This keymap is easy to code for checking code during editor it too.

I can not find this keymap Like this in other editors nor in Lazarus.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6821
  • Debugger - SynEdit - and more
    • wiki
1.0.8 is the latest *released* (and current stable) version.
1.1 is a snapshot, with features that have not yet released. But potentially with new bugs too.

There is NO keymap entry that does what you want.

However there are editor macros
http://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Macros
http://wiki.lazarus.freepascal.org/Editor_Macros_PascalScript

In 1.0.8 macros are still limited to recording keystrokes only. And macros can not be saved. Therefore you must record a macro each time you need it.

In 1.1 they can be saved.
In 1.1 you can write a few lines of pascal script, to store the X pos of the caret, paste, restore X, and go 1 line down.
Then (in 1.1) you can assign a key to your macro, and save it.

kyaoga

  • New Member
  • *
  • Posts: 14
  • -[o_o]-
Thank you so much   ::)

Martin_fr

 

TinyPortal © 2005-2018