Author Topic: jumping to end of pasted block  (Read 3717 times)

PChady

  • Community Member
  • Posts: 18
  • Hero Points: 1
jumping to end of pasted block
« on: November 27, 2007, 09:28:11 pm »
Hi,

I'd like to set the location of the cursor after a block paste - I'm looking for an option/setting/binding or whatever to do so.

Currently, when using the block copy and paste function, the cursor is placed to the top left of the pasted block
after the paste command.

I'd like to have the cursor jump to the "end" of the block, or really, the beginning of the "next" block, and be in position such that if I paste again, the next block will line up directly below the first one.
  (the same location as hitting the down arrow a number of times after the paste to get down below the block)

the upshot is.. I'd like to hit the sequence:     
Ctrl-C      <-- copy the block that I'm on.
Ctrl-v      <-- I am configured to leave the selection in place, and this paste "replaces" the original copy, and now jumps down to
                     the next block position
Ctrl-v      <-- pastes block copy 2 directly below original
Ctrl-v      <-- pastes block copy 3 directly below 2
Ctrl-v      <-- etc
Ctrl-v 

In order to quickly build a vertical column of text or data.

So here's my example source:
#define EXEC_Code1a      0x2bad2bad
#define EXEC_Code1b      0xacdeacde
#define EXEC_Code2a     
#define EXEC_Code2b     
#define EXEC_Code3a     
#define EXEC_Code3b     

I want to highlight the block:
                      0x2bad2bad
                      0xacdeacde

and then hit  COPY PASTE PASTE PASTE

to get:

#define EXEC_Code1a      0x2bad2bad
#define EXEC_Code1b      0xacdeacde
#define EXEC_Code2a      0x2bad2bad
#define EXEC_Code2b      0xacdeacde
#define EXEC_Code3a      0x2bad2bad
#define EXEC_Code3b      0xacdeacde

This is one of the last Codewright behaviors that I miss...

Thanks,

Pete C

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1246
  • Hero Points: 125
Re: jumping to end of pasted block
« Reply #1 on: November 27, 2007, 09:51:23 pm »
There is a def-var that controls that I behavior, at least it's in 12.0.3.  You'll have to set it on the command-line, as there is no gui option available to set it.  On the SlickEdit command-line, enter:
set-var def_paste_block_cursor_end 1

There also appears to be no documentation on it, so I'm going by the macro code is doing with it.  The default value is 0, which leaves the cursor at the insertion point.  Setting it to 1 sets the cursor on the next line down below the inserted text on the same column, and setting 2 places the cursor on the last line/last column of the inserted text.  There is also a setting 3, which kinda works like setting 1, so I'm not exactly sure why it's there. 

PChady

  • Community Member
  • Posts: 18
  • Hero Points: 1
Re: jumping to end of pasted block
« Reply #2 on: November 27, 2007, 09:59:15 pm »
Perfect!

I set that value to 1 through the macros/ Set Macro Variable  window, and all is well - exactly what I wanted.

color me happy!
 8-)


Thanks!
Pete

thefrogger

  • Community Member
  • Posts: 38
  • Hero Points: 2
Re: jumping to end of pasted block
« Reply #3 on: November 28, 2007, 06:09:15 pm »
Sweet! This is great, thanks.

Note that there's another nifty way to insert text at the same column position in multiple lines, if the text is the same on every line. (Posted by Lisa in the "Did You Know" forum).

"Use block selections to insert the same characters on each line. Make a block selection that is one character wide, then type the characters to insert. Those characters will be inserted on each line in the block selection. This is a quick way to insert line comments at the specified column or prefix a series of calls with an object name."

jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: jumping to end of pasted block
« Reply #4 on: November 28, 2007, 07:14:31 pm »
Hi,

It's good that the def_paste_block_cursor_end does what you want in this situation.

Another technique for this sort of thing in general is to use macro record/playback:

  1. Press Ctrl+F11 (record-macro-toggle)
  2. Press Ctrl+V (paste)
  3. Move cursor to next position
  4. Press Ctrl+F12 (record-macro-end-execute) to save and execute macro
  5. Repeat Ctrl+F12 as many times as necessary

Also, if you use locked selections then commands like copy-to-cursor and end-select can be very quick for copying chunks around.

Regards

John Hurst
Wellington, New Zealand