I have written the following macro:
Code: Select all
$locationofcursor = selection location
Select Start
Set Selection $locationofcursor, 1
Cut
set selection location -1
Set Selection $locationofcursor , 1
Paste
Select End
Thanks for your help.
Code: Select all
$locationofcursor = selection location
Select Start
Set Selection $locationofcursor, 1
Cut
set selection location -1
Set Selection $locationofcursor , 1
Paste
Select End
Correct, the Set Selection Location command takes an absolute character location/offset in the document. Thus if your document contains (N) characters then only (1) through (N + 1) are valid locations.lawrencegoodman wrote:I get an error because evidently you can't use negative numbers.
Code: Select all
$locationofcursor = selection location
Select Start
Set Selection $locationofcursor, 1
Cut
Begin Perl
$locationofcursor = $locationofcursor - 1;
End
Set Selection $locationofcursor , 0
Paste
Select End