SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started 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?
-
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.
-
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).
-
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:
#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
-
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.
-
@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.
-
Add this to your unselectall() macro (instead of doing pop-bookmark, in this case).
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.
-
Nice, thanks!