Author Topic: macro functions search vs find  (Read 2792 times)

mzel

  • Community Member
  • Posts: 29
  • Hero Points: 0
macro functions search vs find
« on: March 08, 2021, 12:38:06 AM »
I am pretty sure this question must have been asked before, but I can not find the answer.
What is the difference between the search() and find() functions?

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: macro functions search vs find
« Reply #1 on: March 08, 2021, 07:13:42 AM »
If search looks like it does what you want you should call search rather than find  - it's a low level built in function that is called from find.  Lots of slick c code calls search but very little calls find.  The search command does very little apart from searching for a string in a buffer  - it looks like it can set up highlighting in the buffer (the # option) but it mostly doesn't affect the state of the editor.  The find command sets up default search options and fiddles with search options and selections, sets the mouse cursor to "busy" and handles multiple cursors plus it handles interactive command line search.

If you type
fp search
on the slick command line it will take you to builtins.e where you will find a prototype but no implementation.  The implementation is in the slick core (C++ code).  The file builtins.e is never compiled - it exists purely to help with tagging and show function call options etc.

If you type
fp find
you will see the implementation of the find function in search.e.

Also have a look at SlickCMacroBestPractices.pdf in the installation folder if you're new to macros.

mzel

  • Community Member
  • Posts: 29
  • Hero Points: 0
Re: macro functions search vs find
« Reply #2 on: March 08, 2021, 01:16:15 PM »
@Graeme - Thanks for a prompt answer!