Select to Beginning of Paragraph

Help with writing and playing macros

Select to Beginning of Paragraph

Postby Blue4ce » Sun Mar 21, 2010 4:54 pm

Hi,

I am trying to copy textpad's built-in behaviour in ultraedit 16.00.

I have the text as below
step 1: When I place my cursor at the second h of line 11, and press ctrl+shift+Up arrow, I want the selection as below
2.png
2.png (3.13 KiB) Viewed 1698 times


step 2: Then when I press ctrl+shift+up arrow again, I want the selection to extend one paragraph upward, as
3.png
3.png (4.96 KiB) Viewed 1698 times


I am using the macro,

InsertMode
ColumnModeOff
HexOff
PerlReOn
Find RegExp Up Select "^\s*\n"
IfFound
Else
SelectToTop
EndIf

with a keyboard hotkey = ctrl+shift+Up Arrow

But at step 2, it doesn't extend the selection, instead selects only the above paragraph as
4.png
4.png (3.46 KiB) Viewed 1698 times


Can someone help with the macro ?
Blue4ce
Newbie
 
Posts: 2
Joined: Sun Mar 21, 2010 3:06 pm

Re: Select to Beginning of Paragraph

Postby bernd » Mon Mar 22, 2010 1:21 am

interestingly for me it works in UltraEdit 10.10c with the macro slightly modified:

Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOff
Find RegExp Up Select "%[ ^t]++^p"
IfFound
Else
SelectToTop
EndIf
bernd
Newbie
 
Posts: 3
Joined: Mon Mar 15, 2010 12:34 pm

Re: Select to Beginning of Paragraph

Postby Mofi » Mon Mar 22, 2010 1:54 am

Bernd is right, his macro using the UltraEdit regex engine works, also with UE v16.00.0.1032.

I tested this manually and found out that when using the Perl regular expression engine for a Find Select upwards, the existing selection is not recognized because of wrong cursor location after searching upwards (at bottom end of selection (= beginnig of search) instead at top end (= end of search)) while doing multiple Find Select downwards with the Perl engine works. With UltraEdit and Unix regex engines both directions work. I reported this issue by email to IDM support. As workaround use the macro written by Bernd.

Edited on 2010-08-31: The problem with Find Select upwards not retaining existing selection when using the Perl regular expression engine was fixed with UltraEdit v16.20.0.1009.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Select to Beginning of Paragraph

Postby Blue4ce » Mon Mar 22, 2010 12:04 pm

Thanks Bernd and Mofi.
Blue4ce
Newbie
 
Posts: 2
Joined: Sun Mar 21, 2010 3:06 pm


Return to Macros