Assign search buffer from macro
Tony Balinski
ajbj at free.fr
Fri Jun 29 11:09:00 CEST 2007
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
More information about the Discuss
mailing list