SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: Ding Zhaojie on December 18, 2008, 04:06:02 AM

Title: An improved “quick-highlight”
Post by: Ding Zhaojie on December 18, 2008, 04:06:02 AM
Works as "quick-highlight" but...
* quick highlights word in all buffers (like SourceInsight)
* supports multiple highlight colors (Add your favorite color in hl_color_tbl)
* allows un-highlight a single word

Install:
1. load highlight.e
2. Open tbfind.e, import highlight.e and call hl_reset() at the end of clear_highlights() funtion.
3. reload tbfind.e, so you can use clear-highlights command to clear all highlights now
4. bind a key or menu item for hl-word command.

Usage:
* run hl-word to highlight the word in all buffers.
* run hl-word again to un-highlight the word.
Title: Re: An improved “quick-highlight”
Post by: beaver on January 14, 2009, 10:10:22 PM
Hi Ding,

I have been looking for this feature for a while. Previously, I used gvim editor in my development and I have scrips that will do multiple highlights. When I switched to SE, I missed that feature :(

Anyway, I followed your instructions to install highlight.e but ran across some issues in step2:
     2. Open tbfind.e, import highlight.e and call hl_reset() at the end of clear_highlights() funtion.
   
Do I import the file correctly? I copied the file "highlight.e" to ../Slickedit/macros directory and added the following lines to tbfind.e
     #import "highlight.e"
     _command void clear_highlights()
    {    .
         .
         hl_reset();
    }
I was able to reload tbfind.e (Macro->Load Module...) without any problem. But when I do highlighting, I get these errors:

 Stack trace written to file: /tmp/vsstack.aa
 Procedure hl-reset not found
tbfind.ex 25069 clear_highlights()   p_window_id: 74   p_object: OI_FORM   p_name:
vi.ex 1847 vi_search(first_buf_id,uI@P*#)   p_window_id: 74   p_object: OI_FORM   p_name:
ex.ex 1020 ex_search_mode()   p_window_id: 74   p_object: OI_FORM   p_name: [/right][/center]

What do I need to do to fix these errors?

Thanks in advance..

-Beaver



     
Title: Re: An improved “quick-highlight”
Post by: beaver on January 14, 2009, 10:16:57 PM
BTW.. I forget to mention that I'm using slickedit2007 and running on linux environment. Here are the details:
 
SlickEdit Version 12.0.3.0
Red Hat Enterprise Linux WS release 4 (Nahant Update 2)

Thanks,

-Beaver
 
Title: Re: An improved “quick-highlight”
Post by: chrisant on January 15, 2009, 12:53:04 AM
You reloaded the tbfind.e module.
Did you also load the highlight.e module?

Copying the highlight.e file isn't enough, you have to load the module, too.
Title: Re: An improved “quick-highlight”
Post by: beaver on January 18, 2009, 08:44:49 AM
Christant, thanks for your replied.

I did load the highlight.e before i reloaded the tbfinde.

I think the problem is when the hl_reset() function is being call inside tbfind.e file. Somehow the declaration for hl_reset() has to be visible. I thought having #import in tbfind.e will resolve this problem but apparently it does not.

-Beaver
Title: Re: An improved “quick-highlight”
Post by: chrisant on January 18, 2009, 11:23:30 AM
What happens when you try to invoke the "hl_word" command from the SlickEdit command line?
Title: Re: An improved “quick-highlight”
Post by: Ding Zhaojie on January 19, 2009, 01:42:54 AM
I have not tried it in v12 yet. I think it might because there is something wrong in compiling so the hightlight.e has not been loaded successfully. Load it again and watch the result (the result will show on the status bar).
Title: Re: An improved “quick-highlight”
Post by: jporkka on January 22, 2009, 06:30:20 PM
I like this, but I don't like the limitation of highlighting words only.
By using the "get_quick_search_word" function, I enhanced it to use the word at the cursor or the current selection.
Then, if there is no selection, hl_word behaves as it does now. If there is a selection, it uses the selected text for highlighting (just like quick_search). Note that when highlighting a selection, the matching is also case-insensitive.

Title: Re: An improved “quick-highlight”
Post by: dunkers on January 25, 2009, 09:59:45 PM
Notepad++ has this, but slightly enhanced: if you double click a string then all other instances of that new selection are highlighted. Saves the right click... I haven't yet decided if it's really useful or really annoying. This highlight for SE is a great step in that direction, thanks Ding.
Title: Re: An improved “quick-highlight”
Post by: Ding Zhaojie on January 26, 2009, 04:32:30 PM
Notepad++ has this, but slightly enhanced: if you double click a string then all other instances of that new selection are highlighted. Saves the right click... I haven't yet decided if it's really useful or really annoying. This highlight for SE is a great step in that direction, thanks Ding.
Yeah I've tried Notepad++. It is convenient while reading codes but very annoying while writing codes.

But I have another macro implemented a "IDA-like" highlighting manner. The idea was borrowed from IDA Pro: it highlights the words automatically (even without double click on it). I like to bind the "ida-like-highlight" command to Ctrl+Shift+H and turn it on while analyzing codes.
Title: Re: An improved “quick-highlight”
Post by: dunkers on January 26, 2009, 05:13:13 PM
I'll take a look, thanks. Not sure that I'd remember to turn it on, and leaving it on could be excessively annoying, but as a work displacement activity this is great :)
Title: Re: An improved “quick-highlight”
Post by: Ding Zhaojie on January 29, 2009, 07:42:58 AM
I'll take a look, thanks. Not sure that I'd remember to turn it on, and leaving it on could be excessively annoying, but as a work displacement activity this is great :)

Each time while SE starts, the ida-like-highlight feature will be disabled automatically so it will never bother you :)
Title: Re: An improved “quick-highlight”
Post by: dunkers on January 29, 2009, 11:57:54 AM
Takes some getting used to. I seem to have lost the quickhighlight hilights somewhere along the line: it says it's highlighting but nothing is.
Title: Re: An improved “quick-highlight”
Post by: tomek on February 02, 2009, 04:05:48 PM
Will highlight.e macro work with Slick Edit v 11.0.2 on Windows? I am getting the following error when I try to load highlight.e

"Identifier 'CFG-SYMBOL-HIGHLIGHT' not declared"

thomas
Title: Re: An improved “quick-highlight”
Post by: Ding Zhaojie on February 04, 2009, 03:37:12 AM
Will highlight.e macro work with Slick Edit v 11.0.2 on Windows? I am getting the following error when I try to load highlight.e

"Identifier 'CFG-SYMBOL-HIGHLIGHT' not declared"
I'm not quite sure if it could work with v11. But I think just remove the CFG-SYMBOL-HIGHLIGHT in the color table might works. The symbol highlight feature was introduced in v13 so v11 does not have this color.
Title: Re: An improved “quick-highlight”
Post by: Ding Zhaojie on February 04, 2009, 03:41:21 AM
Takes some getting used to. I seem to have lost the quickhighlight hilights somewhere along the line: it says it's highlighting but nothing is.
These two mod could not be used together, the ida-like-highlight will clear all quick highlights while it was activated.
Title: Re: An improved “quick-highlight”
Post by: tomek on February 04, 2009, 04:56:19 PM
I've got it to work with v11 after removing CFG-SYMBOL-HIGHLIGHT.  :) Thanks a lot.
Title: Re: An improved “quick-highlight”
Post by: dunkers on February 04, 2009, 06:21:05 PM
Quote
These two mod could not be used together

I resolved it by using fixed highlights - loads of colors are nice but I can cope with one :)

My main problem is remembering I've loaded them up and can use them.  ::)
Title: Re: An improved “quick-highlight”
Post by: dudu1102 on February 07, 2009, 05:33:57 AM
 :'(

My problem is load this moudles from Marco, i see
unenable to create output file: /opt/slickedit/marco/ida-like-highlight.ex .


WHY ????
Title: Re: An improved “quick-highlight”
Post by: dunkers on February 07, 2009, 12:22:16 PM
Sorry, I'm not really into macro programming and even less into *nix. Nevertheless, that looks to me like a generic macro problem rather than a highlight specific one. Do you have write rights to the macro directory? Is that path really called that or was 'marco' a typo in copying?
Title: Re: An improved “quick-highlight”
Post by: Ding Zhaojie on February 07, 2009, 12:38:55 PM
Make sure you have write permission on the macro directory, or just copy .e file to your home directory and load it there.