Antwort: Re: Assign search buffer from macro

Rene.Eng at telekurs.com Rene.Eng at telekurs.com
Fri Jun 29 13:20:56 CEST 2007


Hi Tony


Yes, find() does the trick. Thank you very much!

Actually, the search() call between the positioning and the find() call is 
not necessary in my case.


Regards,
René





Tony Balinski <ajbj at free.fr> 
Gesendet von: discuss-bounces at nedit.org
29.06.2007 11:09
Bitte antworten an
General NEdit discussion list <discuss at nedit.org>


An
General NEdit discussion list <discuss at nedit.org>
Kopie

Thema
Re: Assign search buffer from macro






Quoting Rene.Eng at telekurs.com:

> Hi all
>
>
> In my macro I'd like to assign a string to the search buffer. The idea 
is
> that, after executing my macro, the user can type Ctrl-h to jump to the
> next occurence of the search string.
>
> I tried calling 'search' and 'replace_selection', but both did not yield
> the expected result.
>
> Is there any way to do that? Or would it need a new subroutine in nedit?
>
>
> Thank you very much for your help,
> René

Use the find/replace action routines instead. These act as if you had used 
the
find/replace dialog. Look in Help> Macro/Shell Extensions> Action 
Routines.

The action routines don't return anything to the calling macro, and these 
ones
will act just like the interactive actions, altering any selection you 
have.
If in your macro you need the returned results of a search, use search as 
you
do now, then set_cursor_pos() to position your cursor in front of your 
found
section, then call find() with the same search string, so that it finds 
what
search() found before. find() adds the search string/regex and search type 
to
the find dialog's history, and allows Ctrl-G to find-again using that last
search string, as you require.

Let us know if this solves your problem,

Tony

-- 
NEdit Discuss mailing list - Discuss at nedit.org
http://www.nedit.org/mailman/listinfo/discuss




More information about the Discuss mailing list