"Highlight All Items Found" Interfering with Macro

Find, replace, find in files, replace in files, regular expressions

"Highlight All Items Found" Interfering with Macro

Postby boliva » Thu Aug 20, 2009 1:13 am

I have a Macro that selects the current line of text (^.+$) and replaces it. Works fine when "Highlight All Items Found" is off. When it's on, the entire file gets selected. Is there a way to turn it off in the Macro?
boliva
Newbie
 
Posts: 4
Joined: Fri Aug 15, 2008 8:02 pm

Re: "Highlight All Items Found" Interfering with Macro

Postby Mofi » Thu Aug 20, 2009 3:34 am

No, this setting can't be controlled from within a macro or a script. Well, this option should not be active during a script or macro execution as the find option List Lines Containing String and since UE v13.20a also the replace option Replace All is from top of file. Originally the find option Highlight All Items Found was no problem for finds executed from within a macro or script because this option was always automatically disabled after the find was executed by the user and macros/scripts could not enable it. It looks like the IDM developers have forgotten that for find option Highlight All Items Found also a special handling must be used as this find option became "permanent enabled" (= remembered) optionally.

I suggest you send a bug report email to IDM describing the problem with a good example - test file and your macro shortened to demonstrate this issue. The IDM developers have to:

-) save the state of the find option Highlight All Items Found on start of a macro/script
-) set this find option to false (= disabled)
-) restore the state of this find option after exit of the macro/script

If you want I can also report it although I have to create first an example for demonstration.

As possible workaround you could use in your macro a replace command instead of a find for selecting the line content and a text write to overwrite the selection as it looks like you are using.

Also possible would be to use command SelectLine which selects also the displayed line with line termination and therefore the new text must also end with a line termination. Last you could maybe also use

GotoLine 0 1
StartSelect
Key END
EndSelect

for selecting the line without line termination. Note: SelectLine as well as the code above selects only the just displayed line. That is important if you are using soft word-wrap.

Update: I could not reproduce anymore with UE hotfix version 13.20a+1 the described problem with macro execution and Highlight All Items Found enabled.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: "Highlight All Items Found" Interfering with Macro

Postby boliva » Thu Aug 20, 2009 4:59 pm

Thanks, Mofi.

I think one of your workarounds will work for me for now.
boliva
Newbie
 
Posts: 4
Joined: Fri Aug 15, 2008 8:02 pm


Return to Find/Replace/Regular Expressions