wrapped line: move cursor to beginning of total line

Help with writing and playing macros

wrapped line: move cursor to beginning of total line

Postby thomasm76 » Tue Dec 19, 2006 9:08 pm

I've got a macro that searches for a specific line and deletes everthing above that line:

Code: Select all
Find ...
Key HOME
SelectToTop
Delete


This specific line is very long and wrapped in my window it takes 2 or 3 rows. The problem is, that the "Key HOME" just moves the cursor to column 1 of the 2nd or 3rd row of my line (and not to the beginning of the total line) and then deletes row1 of my specific line too :-(

How to move the cursor to the absolute beginning of my line or how to use a command to switch word wrap off in that window?
User avatar
thomasm76
Basic User
Basic User
 
Posts: 19
Joined: Sun Jun 18, 2006 11:00 pm

Re: wrapped line: move cursor to beginning of total line

Postby Mofi » Wed Dec 20, 2006 8:48 am

You can use a regular expression to find real start of a line when soft word wrapping is enabled.

For UltraEdit style - macro contains UnixReOff:

IfColNum 1
Key RIGHT ARROW
EndIf
Find RegExp Up "%"

For Unix/Perl style - macro contains UnixReOn or PerlReOn:

IfColNum 1
Key RIGHT ARROW
EndIf
Find RegExp Up "^"

The IfColNum code is used here to make sure the cursor is not already at start of a line because this could cause moving the cursor to start of previous line.
If you are sure you are always not at start of the line after your Find, remove the 3 lines before the regular expression search. Depending on your version of UE/UES IfColNum is also not working correct if something is select - after a Find for example. In this case the cursor is (normally) also never at start of a line and the 3 lines are also not need.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4064
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: wrapped line: move cursor to beginning of total line

Postby thomasm76 » Wed Dec 20, 2006 11:13 am

Thanks Mofi, it's very simple and it worked! :-)
User avatar
thomasm76
Basic User
Basic User
 
Posts: 19
Joined: Sun Jun 18, 2006 11:00 pm


Return to Macros