Nothing selected anymore after a replace all on selected text with Perl engine (fixed)

Nothing selected anymore after a replace all on selected text with Perl engine (fixed)

2

    Apr 11, 2011#1

    Hi all,
    I hope someone can answer a question for me.

    I've created some macros that perform multiple search and replace operations on a block of selected x86 assembly in order to transform it.

    The start is:

    InsertMode
    ColumnModeOff
    HexOff
    PerlReOn
    Find RegExp SelectText "^//([0-9A-F\?]+).*$"
    Replace All "$1"
    Find RegExp SelectText "\r\n"
    Replace All ""

    This works just fine for me on my machine (and has done so for a few years). However I've copied the macro across to another machine as I've upgraded my dev box, and it no longer works.
    From what I can tell, the selection doesn't persist in the new UltraEdit installation - even after exporting/importing my settings.

    i.e.
    The second (and subsequent):

    Find RegExp SelectText "\r\n"
    Replace All ""

    commands don't work because the text is no longer selected after the first Find/Replace operations.

    Anyone have any idea why this would be? I'll have to hack around it by adding a bunch of SelectToBottom lines (and then make sure I'm only doing this at the end of a text file)... which I'd rather not have to do.

    Thanks.

    6,675585
    Grand MasterGrand Master
    6,675585

      Apr 11, 2011#2

      To be able to look into this problem we need 2 additional data:

      a) Which version of UltraEdit is used on the computer where it does not work (exact version please)?

      b) A sample block on which this macro is executed before and after running the macro and what is selected in that block.

      2

        Apr 11, 2011#3

        Thanks for the reply:

        Version: 16.30.0.1003.

        example code:

        Code: Select all

        //8B4DCC                         mov         ecx,[ebp][-034]
        //8B8560FFFFFF                   mov         eax,[ebp][-0000000A0]
        //898D58FFFFFF                   mov         [ebp][-0000000A8],ecx
        //C78550FFFFFF03400000           mov         d,[ebp][-0000000B0],000004003 ;'  @?'
        //8B4814                         mov         ecx,[eax][014]
        ideally, it should end up like:

        Code: Select all

        8B4DCC8B8560FFFFFF898D58FFFFFFC78550FFFFFF034000008B4814
        Thanks again.

        6,675585
        Grand MasterGrand Master
        6,675585

          Apr 11, 2011#4

          You are right, the macro is not working anymore. I tried the macro on your example with several versions of UltraEdit and found out that it does not produce the correct result from UE v16.30.0.1000 to v17.00.0.1035. Previous versions like UE v16.20.0.1011 or v16.10.0.1036 produce the correct result.

          When executing the 2 replaces manually twice with Selected Text selected for Replace Where, it also does not work. After the first replace the modified lines are highlighted still as they would be still selected, but that is not the case as it can be seen when moving the caret with UP/DOWN ARROW or pressing Ctrl+C (copy) and Ctrl+V (paste).

          Interesting is that running first replace with Current File selected for Replace Where and second replace with Selected Text, the second replace works. Of course that is of no use for you and works only on this small example.

          This is definitely a bug in UltraEdit. I have reported it to IDM support by email and IDM could reproduce the wrong behavior.

          By the way: Using

          InsertMode
          ColumnModeOff
          HexOff
          PerlReOn
          Find RegExp SelectText "^//([0-9A-F\?]+).*\r\n"
          Replace All "$1"


          makes the reformatting job in one replace, but requires that always entire lines are selected. And of course does not remove the DOS line terminators on lines not starting with one of the characters defined in the square brackets.

          Update on 2011-06-03: The problem with selection discarded after Perl regular expression replace all on selected text is fixed in UE v17.10.0.1008.