Author Topic: Clearing push-ref highlights  (Read 2469 times)

Tim Kemp

  • Senior Community Member
  • Posts: 537
  • Hero Points: 91
Clearing push-ref highlights
« on: February 13, 2015, 04:31:20 pm »
I use push-ref all the time and I like that it highlights all the instances of a symbol. I want to clear the highlights out when I'm no longer interested in that symbol. I haven't been able to figure out how to do that short of searching for something that doesn't exist, but that gives an error. Does anyone know how to do this cleanly?

evanratt

  • Senior Community Member
  • Posts: 300
  • Hero Points: 23
Re: Clearing push-ref highlights
« Reply #1 on: February 13, 2015, 04:52:37 pm »
Does 'clear-highlights' work?

Edit: Just checked, and no it doesn't. I didn't realize this feature was there; I'd probably use it if there was a clean way to clear these highlights.
« Last Edit: February 13, 2015, 04:56:21 pm by evanratt »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2960
  • Hero Points: 440
Re: Clearing push-ref highlights
« Reply #2 on: February 17, 2015, 01:44:24 am »
clear_highlights() is for the Search > Find...

The most straightforward way to clear highlights that are created by push-refs is to do a pop-bookmark (Ctrl+,).  Another way to do it is to move the cursor to a blank line and search for references (forcing it to not match anything).

Tim Kemp

  • Senior Community Member
  • Posts: 537
  • Hero Points: 91
Re: Clearing push-ref highlights
« Reply #3 on: February 17, 2015, 12:40:57 pm »
Dennis, I added pop_bookmark() to my "unselect everything" macro. It causes the current position to jump, which isn't good, but it does reverse the results of push-refs. It seems like it wouldn't work if I'd pushed a bookmark in the meantime. It also seems like my call to pop_all_bookmarks ought to have the same results, but it doesn't.

Here is the macro I use:
Code: [Select]
#include "slick.sh"
_command unselectall() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
   _macro('R',1);
   deselect();
   pop_bookmark();
   pop_all_bookmarks();
   clear_highlights();
   clear_scroll_highlights();
}

If a better way to do this comes to mind, please let us know.

Thanks,
Tim

jnairb

  • Senior Community Member
  • Posts: 224
  • Hero Points: 11
Re: Clearing push-ref highlights
« Reply #4 on: February 17, 2015, 03:14:24 pm »
Based on this discussion, I'm not sure that I would want the highlighting, but when I use push-ref, I don't see any highlights. Am I missing some setting?

Nevermind. Just found the Highlight references in editor option.
« Last Edit: February 17, 2015, 03:21:24 pm by jnairb »

Tim Kemp

  • Senior Community Member
  • Posts: 537
  • Hero Points: 91
Re: Clearing push-ref highlights
« Reply #5 on: February 17, 2015, 04:58:41 pm »
@jnairb, I like the highlighting, it makes the symbol instances stand out well. I also turn on highlighting when I'm doing a search.
(e.g. )

I've been using a version of the macro I listed above for years to get rid of the highlighting from searching and the temporary bookmarks I end up with all over the place from jumping around through the code. For me anyway, the highlighting adds a lot and since I have the macro bound to a key, and use it frequently, there isn't really a downside.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2960
  • Hero Points: 440
Re: Clearing push-ref highlights
« Reply #6 on: February 17, 2015, 05:58:49 pm »
Add this to your unselectall() macro (instead of doing pop-bookmark, in this case).
Code: [Select]
   tag_refs_clear_pics();

pop-bookmark is good for normal usage, because it's a nice indication that you are done looking at a set of references.
« Last Edit: February 17, 2015, 06:00:42 pm by Dennis »

Tim Kemp

  • Senior Community Member
  • Posts: 537
  • Hero Points: 91
Re: Clearing push-ref highlights
« Reply #7 on: February 17, 2015, 08:11:20 pm »
Nice, thanks!