Author Topic: Mark Occurrences Feature  (Read 8000 times)

Aarto

  • Guest
Mark Occurrences Feature
« on: March 10, 2008, 07:42:36 PM »
Hello,

In the Java Editor in Eclipse, one can position the cursor over a variable and see
all occurrences of the variable highlighted in the document.

Can this feature be implemented within Slick Edit?

P.S. I'm trial version user, 12.0.3.0.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Mark Occurrences Feature
« Reply #1 on: March 10, 2008, 09:45:39 PM »
That feature is planned for inclusion in SlickEdit 2008, which should be out soon.

Aarto

  • Guest
Re: Mark Occurrences Feature
« Reply #2 on: March 11, 2008, 01:56:35 AM »
oh, that's great to know!

livingintown

  • Community Member
  • Posts: 51
  • Hero Points: 2
Re: Mark Occurrences Feature
« Reply #3 on: March 11, 2008, 02:29:11 PM »
without waiting on this late coming 2008, following code will do what you want.

#pragma option(strict, on)
#include 'slick.sh
_command void
quickSearchVIMode() name_info(',')
{
   /* check last highlight, prevent do highlighting twice */
   _str curWord = _SymbolWord();
   clear_highlights();
   mark_all_occurences(curWord,'UP','0','0','0','1','0','0');
   find(curWord,'UP');
}

You can map "*" key to this command or edit popup menu to call this command.

skilleter

  • Community Member
  • Posts: 14
  • Hero Points: 0
Re: Mark Occurrences Feature
« Reply #4 on: March 12, 2008, 09:42:41 AM »
Can I suggest a tweak to the code, as it doesn't work if the cursor isn't on a word when it is invoked (the cursor jumps to the top of the file).  Using save_pos/restore_pos instead of find fixes this:

#pragma option(strict, on)

#include 'slick.sh

_command void quickSearchVIMode() name_info(',')
{
   typeless currpos;
   _str curWord;

   save_pos(currpos);

   curWord = _SymbolWord();
   clear_highlights();
   mark_all_occurences(curWord,'UP','0','0','0','1','0','0');

   restore_pos(currpos);
}