SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: Tim Kemp on February 13, 2015, 04:31:20 PM

Title: Clearing push-ref highlights
Post by: Tim Kemp 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?
Title: Re: Clearing push-ref highlights
Post by: evanratt 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.
Title: Re: Clearing push-ref highlights
Post by: Dennis 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).
Title: Re: Clearing push-ref highlights
Post by: Tim Kemp 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
Title: Re: Clearing push-ref highlights
Post by: jnairb 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.
Title: Re: Clearing push-ref highlights
Post by: Tim Kemp 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. (http://i.imgur.com/YY8J1ge.png))

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.
Title: Re: Clearing push-ref highlights
Post by: Dennis 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.
Title: Re: Clearing push-ref highlights
Post by: Tim Kemp on February 17, 2015, 08:11:20 PM
Nice, thanks!