Select to Beginning of Paragraph

Select to Beginning of Paragraph

2
NewbieNewbie
2

    Mar 21, 2010#1

    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 (3.13KiB)


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


    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 (3.46KiB)


    Can someone help with the macro ?

    3
    NewbieNewbie
    3

      Mar 22, 2010#2

      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
      

      6,681583
      Grand MasterGrand Master
      6,681583

        Mar 22, 2010#3

        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.
        Best regards from an UC/UE/UES for Windows user from Austria

        2
        NewbieNewbie
        2

          Mar 22, 2010#4

          Thanks Bernd and Mofi.