Author Topic: Symbol Highlighting  (Read 24228 times)

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Symbol Highlighting
« on: April 07, 2009, 11:27:13 PM »
Adds New Commands
ToggleSymHighlight
ClearAllSymHighlight

Written For
SlickEdit 14 (although probably works with earlier versions)

Description
"ToggleSymHighlight" takes the identifier under the cursor and adds it to a list of words to search for.  All occurances of these words will be highlighted yellow.  If the identifier already exists in the list of words, then instead it is removed from the list and is no longer highlighted.
"ClearAllSymHighlight" brings up a message box listing all the identifiers currently being highlighted.  If you respond yes then this list is completely purged.

Installation
Copy the attached SymHighlight.e locally and load using Macro | Load Macro

Acknowledgements
Thanks to ChrisAnt for his Codemarkup.e macros.  I refered to them heavily in making this

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #1 on: April 08, 2009, 09:58:39 PM »
Well, found my first bug.  If you had one symbol being highlighted in multiple buffers and then toggled it off, the highlighting would be removed from that one buffer only, all other buffers would still have it highlighted.  I was preventing UpdateScreen from being called if there were no symbols in the s_symTags array.  This has now been fixed.

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #2 on: April 14, 2009, 02:07:37 AM »
This time I put a bit more testing into this macro before uploading.  It appears to be working correctly for me now.
The following changes have been made.
  • The search line will only look for full words that are not in a comment instead of highlighting a part of a word if it matched
  • Replaced a call to cur_identifier with cur_word so it'll work with SlickEdit V12
  • Made it use 5 different colours rather than have every tagged word highlighted the same colour
If anyone finds it still broken in some way, please let me know.  I really thought it was working fine originally.

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #3 on: April 21, 2009, 10:54:10 PM »
I have hopes this is the last bug fix ;D.  It's taking longer to find them and the cases where they occur seem rarer.
This time it's a fix for the definit function.  When I reloaded the macro, or any other time definit can be called after you were using the function, I cleared out the colours used but didn't clear out the word list or the link from a word to a colour.  The resulted in the code being able to find the word, create a marker but not have the range coloured.
I now make sure to clear out the word lists under definit as well as the colours.
To make it easier to figure out what's going wrong I've also added DbgDumpSymHighlight which will hopefully dump out enough info to figure out what's broken.
My apologies to anyone I've frustrated with these bugs in my macro.

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #4 on: April 06, 2011, 10:13:13 PM »
Here's a new version that fixes yet more bugs.
It now will update all open windows on one pass (I ususally only have one up at a time so I never noticed this issue).
If you're trying to highlight two symbols where one is a substring of the other, the order toggled no longer matters.
You can use set-var def_sym_highlight_delay to speed up or slow down the frequency of updating

Please let me know if you find any issues with this.

ewendt

  • Community Member
  • Posts: 42
  • Hero Points: 2
Re: Symbol Highlighting
« Reply #5 on: November 26, 2011, 11:38:36 AM »
 :)

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #6 on: January 26, 2012, 11:43:35 PM »
I got tired of running into cases where the highlight colour chosen, even though the least used, matched that of other symbols nearby.  I've added the command CycleSymHighlight that will highlight the current symbol if it isn't already, and if it is already highlighted it will change the highlight colour to the next available one.

sdayts

  • Community Member
  • Posts: 42
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #7 on: February 19, 2012, 12:51:49 PM »
Marksun,

I did not know how much I needed this macro until I started using it.
Love it...

Thank you so much for sharing!

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #8 on: May 10, 2013, 06:05:11 PM »
Thanks to a coworker who was working in perl, a bug was discovered.  I had failed to escape re-expr characters so you couldn't highlight perl literals.  This has now been fixed and posted here.

chandlerzhang

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Symbol Highlighting
« Reply #9 on: May 27, 2013, 12:39:27 AM »
modify this for colorful scroll mark symbol.


#include "slick.sh"
#import "main.e"
#include "markers.sh"

int s_modtimeSymHighlight = -1;
int s_markertypeSymHighlight = -1;
int s_timerSymHighlight = -1;
_str s_searchString = '';
_str s_symTags[];
int s_keyColour:[];

int def_sym_highlight_delay = 5000;


static int scroll_mark_type[];
static int colorindex[];
static int gerror_scroll_mark_type = 0;
static int oldColor = 0;

struct SymColour
{
   int m_ColourSymHighlight;
   int m_cRef;    // used for delayed color creation and selection.
   int m_rgb;
   int m_scolType;
} s_symColour[];


_command void CycleSymHighlight() name_info(',')
{
   _str sym = cur_word(start_col);

   if (length(sym) != 0)
   {
      int i;
      boolean fAdd = true;
      for (i = 0; i < s_symTags._length() && fAdd; i++)
      {
         if (s_symTags == sym)
         {
            fAdd = false;

            if (s_keyColour._indexin(sym))
            {
               int iColour = s_keyColour:[sym];

               s_symColour[iColour].m_cRef -= 1;

               iColour = (iColour + 1) % s_symColour._length();
               s_keyColour:[sym] = iColour;

               s_symColour[iColour].m_cRef += 1;

               EnsureColour(iColour);

               UpdateScreen(true /* update now */)
            }
         }
      }

      if (fAdd)
      {
         ToggleSymHighlight();
      }
   }
}

static int _error_scroll_marker_get_type(int color)
{
   int index;

   for(index = 0; index < s_symColour._length(); index ++)
   {
      if(color == s_symColour[index].m_ColourSymHighlight)
      {
         break;
      }
   }

   if(index >= s_symColour._length())
   {
      index = 0;
   }

   return scroll_mark_type[index];
}

void scrolllmarkerinfo()
{
   int i = 0;
   SCROLLBAR_MARKUP_INFO   scrollMarkupInfo[];
   //get_window_id(p_window_id);
   _ScrollMarkupGetMarkup(p_window_id,scrollMarkupInfo);
   
   message("len:"scrollMarkupInfo._length());
   for (i = 0; i < scrollMarkupInfo._length(); i++) {
      message("len:"scrollMarkupInfo._length()"line"scrollMarkupInfo.lineNumber"type"scrollMarkupInfo.type"len"scrollMarkupInfo.len);
      _ScrollMarkupRemoveAllType(scrollMarkupInfo.type);
   }
}

void removeallscrolllmarker(int wid)
{
   int i = 0;
   SCROLLBAR_MARKUP_INFO   scrollMarkupInfo[];
   _ScrollMarkupGetMarkup(wid,scrollMarkupInfo);
   
   for (i = 0; i < scrollMarkupInfo._length(); i++) {
 //     message("len:"scrollMarkupInfo._length()"line"scrollMarkupInfo.lineNumber"type"scrollMarkupInfo.type"len"scrollMarkupInfo.len);
      _ScrollMarkupRemoveAllType(scrollMarkupInfo.type);
   }
}

void removeallmarker()
{
   int i = 0;
   SCROLLBAR_MARKUP_INFO   scrollMarkupInfo[];
   get_window_id(auto orig_view);
   _ScrollMarkupGetMarkup(orig_view,scrollMarkupInfo);
   
   for (i = 0; i < scrollMarkupInfo._length(); i++) {
 //     message("len:"scrollMarkupInfo._length()"line"scrollMarkupInfo.lineNumber"type"scrollMarkupInfo.type"len"scrollMarkupInfo.len);
      _ScrollMarkupRemoveAllType(scrollMarkupInfo.type);
   }
}


/* T O G G L E  S Y M  H I G H L I G H T */
/*----------------------------------------------------------------------------
   %%Function: ToggleSymHighlight
   %%Author: MarkSun
   %%Owner: MarkSun

   If the IP is on an identifier, either add it or remove it from the list
   of identifiers we're tracking for highlighting purposes.

----------------------------------------------------------------------------*/
_command void ToggleSymHighlight() name_info(',')
{
   int start_col;
   int i;
   _str sym;

   if (_select_type()!='')
   {
      begin_select();
      _deselect();
   }

   sym = cur_word(start_col);
   if (length(sym) != 0)
   {
      boolean fAdd = true;
      for (i = 0; i < s_symTags._length();i++)
      {
         if (s_symTags == sym)
         {
            fAdd = false;
            s_symTags._deleteel(i);
            break;
         }
      }

      if (fAdd)
      {
         int cTags = s_symTags._length();
         s_symTags[cTags] = sym;
         s_symTags._sort("D");
         if (s_symTags._length() != cTags + 1)
         {
            say("Failed to add tag: " :+ sym);
         }
      }

      if (s_symTags._length() > 0)
      {
         s_searchString = _escape_re_chars(s_symTags[0], 'U');
         for (i = 1; i < s_symTags._length(); i++)
         {
            s_searchString :+= '|' :+ _escape_re_chars(s_symTags, 'U');
         }

      }
      else
      {
         s_searchString = '';
         _StreamMarkerRemoveType (p_window_id, s_markertypeSymHighlight);
         removeallmarker();
      }     

      UpdateScreen(true /* update now */)

      if (!fAdd && s_keyColour._indexin(sym))
      {
         int index = s_keyColour:[sym];
         if (index < 0 || index > s_symColour._length())
         {
            say("bad index in keycolour for: " :+sym);
         }
         else
         {
            if (index > s_symColour._length())
            {
               say("bad index for symColour (index/sym): ":+index:+"/":+sym);
            }
            else if (s_symColour[index].m_cRef <= 0)
            {
               say("bad cRef in symColour when deleting: " :+ sym);
            }
            else
            {
               s_symColour[index].m_cRef -= 1;
               s_keyColour._deleteel(sym);
            }
         }
      }
      else if (!fAdd)
      {
         say("Failed to remove keycolour for: ":+sym);
      }

   }

}

static void _InitSymColour()
{
   s_symColour[0].m_ColourSymHighlight = -1;
   s_symColour[0].m_rgb = _rgb(0xff, 0x00, 0x00);/* red */
   s_symColour[0].m_cRef = 0;

   s_symColour[1].m_ColourSymHighlight = -1;
   s_symColour[1].m_rgb = _rgb(0x00, 0x00,0xff );/* green */
   s_symColour[1].m_cRef = 0;

   s_symColour[2].m_ColourSymHighlight = -1;
   s_symColour[2].m_rgb = _rgb(0xff, 0x00, 0xff);/* red + blue */
   s_symColour[2].m_cRef = 0;

   s_symColour[3].m_ColourSymHighlight = -1;
   s_symColour[3].m_rgb = _rgb(0xff, 0xff, 0x00);/* red + green */
   s_symColour[3].m_cRef = 0;

   s_symColour[4].m_ColourSymHighlight = -1;
   s_symColour[4].m_rgb = _rgb(0x00, 0xff, 0xff);/* green + blue */
   s_symColour[4].m_cRef = 0;
}

static void _InitScrollMark()
{
   colorindex[0] = _AllocColor();
   colorindex[1] = _AllocColor();
   colorindex[2] = _AllocColor();
   colorindex[3] = _AllocColor();
   colorindex[4] = _AllocColor();
   scroll_mark_type[0] = _ScrollMarkupAllocType();
   _default_color(colorindex[0], _rgb(0x00, 0x00, 0x00), s_symColour[0].m_rgb, 0);
   _ScrollMarkupSetTypeColor(scroll_mark_type[0],colorindex[0]);

   _default_color(colorindex[1], _rgb(0x00, 0x00, 0x00), s_symColour[1].m_rgb, 0);
   scroll_mark_type[1] = _ScrollMarkupAllocType();
   _ScrollMarkupSetTypeColor(scroll_mark_type[1],colorindex[1]);

   _default_color(colorindex[2], _rgb(0x00, 0x00, 0x00), s_symColour[2].m_rgb, 0);
   scroll_mark_type[2] = _ScrollMarkupAllocType();
   _ScrollMarkupSetTypeColor(scroll_mark_type[2],colorindex[2]);

   _default_color(colorindex[3], _rgb(0x00, 0x00, 0x00), s_symColour[3].m_rgb, 0);
   scroll_mark_type[3] = _ScrollMarkupAllocType();
   _ScrollMarkupSetTypeColor(scroll_mark_type[3],colorindex[3]);

   _default_color(colorindex[4], _rgb(0x00, 0x00, 0x00), s_symColour[4].m_rgb, 0);
   scroll_mark_type[4] = _ScrollMarkupAllocType();
   _ScrollMarkupSetTypeColor(scroll_mark_type[4],colorindex[4]);
}

_command void DbgDumpSymHighlight() name_info(',')
{
   int i;
   say ("--- SymHighlight dump: " :+ _time('L'));
   say ("search string:");
   say ("   " :+ s_searchString);
   say ("word list:");
   for (i = 0; i < s_symTags._length(); i++)
   {
      say ("   " :+ (i+1) :+ ": " :+ s_symTags);
   }
   say ("Colours index for words:");
   for (i = 0; i < s_symTags._length(); i++)
   {
      if (s_keyColour._indexin(s_symTags))
      {
         say ("   " :+ s_symTags :+ ": " :+ s_keyColour:[s_symTags] + 1);
      }
      else
      {
         say ("   " :+ s_symTags :+ ": no current colour");
      }
   }
   say ("colour cRefs:");
   for (i = 0; i < s_symColour._length(); i++)
   {
      say ("   " :+ (i + 1) :+ ": " :+ s_symColour.m_cRef);
   }



   say ("--- End SymHighlight dump");

}


void DoClearAllSymHighlightStructs()
{
   int i;
   s_symTags._makeempty();
   s_searchString = '';
   for (i = 0; i < s_symColour._length(); i++)
   {
      if (s_symColour.m_cRef > 0)
      {
         s_symColour.m_cRef = 0;
      }
   }
   s_keyColour._makeempty();
}


/* C L E A R  A L L  S Y M  H I G H L I G H T */
/*----------------------------------------------------------------------------
   %%Function: ClearAllSymHighlight
   %%Author: MarkSun
   %%Owner: MarkSun

   Bring up a dialog listing all identifiers that we are currently highlighting.
   If you respond Yes, then clear the entire list.

----------------------------------------------------------------------------*/
_command void ClearAllSymHighlight() name_info(',')
{

   _str result;
   _str messageString = "Clear the following list?\n\n";
   int i;

   for (i = 0; i < s_symTags._length(); i++)
   {
      messageString :+= (i+1) :+ ": " :+ s_symTags :+ "\n";
   }
   //result=_message_box(messageString, '', MB_YESNO|MB_ICONQUESTION);
   //if (result==IDYES)
   {
      DoClearAllSymHighlightStructs();
      UpdateScreen(true);
   }

   _RemoveAllScrollMarker();
}


void _RemoveAllScrollMarker()
{
   get_window_id( auto orig_view);
   activate_window (_mdi.p_child);
   for_each_mdi_child('removeallmarker','');
   activate_window(orig_view);
}

void _UpdateWindow()
{
   typeless p,m,ss,sf,sw,sr,sf2;
   _save_pos2(p);
   save_selection(m);
   save_search(ss, sf, sw, sr, sf2);
   _StreamMarkerRemoveType (p_window_id, s_markertypeSymHighlight);
   removeallscrolllmarker(p_window_id);

   if (s_symTags._length() != 0)
   {
      _deselect();
      top();
//         if ( !search('(?:' :+ s_searchString :+ ')', '<U@WXC') )
      if ( !search(s_searchString, '<U@W') )
      {
         do
         {
            s = strip( get_text( match_length(), (int)_QROffset() ), 'T' );
            long offset_highlight = _QROffset();
            int length_Highlight = s._length();
            int pos_marker = _StreamMarkerAdd( p_window_id,
                                               offset_highlight,
                                               length_Highlight,
                                               true, 0,
                                               s_markertypeSymHighlight, '');
            _StreamMarkerSetTextColor(pos_marker, GetSymHighlightColour(s));
            int line =(int) _QLineNumberFromOffset(offset_highlight);
            int error_scroll_markup_type = _error_scroll_marker_get_type(GetSymHighlightColour(s));
            // message("p_window_id:"p_window_id"p_line:"p_line"line:"line"s:"s":"s_markertypeSymHighlight"scroll:"error_scroll_markup_type);
            _ScrollMarkupAdd(p_window_id, line, error_scroll_markup_type);
         }
         while (!repeat_search( '<U@W'));
      }
   }

   restore_search( ss, sf, sw, sr, sf2);
   restore_selection(m);
   _restore_pos2(p);

   refresh();
}


/* U P D A T E  S C R E E N */
/*----------------------------------------------------------------------------
   %%Function: UpdateScreen
   %%Author: MarkSun
   %%Owner: MarkSun

   Goes through the current buffer and update the highlights based on current
   information.

----------------------------------------------------------------------------*/
static void UpdateScreen(boolean fNow)
{
   get_window_id( auto orig_view);
   activate_window (_mdi.p_child);

   if (s_modtimeSymHighlight != p_LastModified || fNow)
   {
      s_modtimeSymHighlight = p_LastModified;

      for_each_mdi_child('-UpdateWindow','');
   }
   activate_window(orig_view);
}


/* S Y M  H I G H L I G H T  C A L L B A C K */
/*----------------------------------------------------------------------------
   %%Function: SymHighlightCallback
   %%Author: MarkSun
   %%Owner: MarkSun

   Callback to periodically ensure the current buffer has been updated.

----------------------------------------------------------------------------*/
void SymHighlightCallback()
{
   if ( !p_mdi_child || command_state())
   {
      return;
   }

   if (_idle_time_elapsed() < def_sym_highlight_delay)
   {
      return;
   }

   UpdateScreen(false /* update now */);
}


static void EnsureColour(int iColour)
{
   if (s_symColour[iColour].m_ColourSymHighlight == -1)
   {
      s_symColour[iColour].m_ColourSymHighlight = _AllocColor();
      _default_color(s_symColour[iColour].m_ColourSymHighlight,
                     _rgb(0x00, 0x00, 0x00), s_symColour[iColour].m_rgb, 0);
   }
}

static int IGetNextSymColour()
{
   int i, iMac;
   int iTarget = 0, iTargetVal = s_symColour[0].m_cRef;

   iMac = s_symColour._length();

   if (iTargetVal != 0)
   {
      for (i = 1; i < iMac; i++)
      {
         if (s_symColour.m_cRef < iTargetVal)
         {
            iTargetVal = s_symColour.m_cRef;
            iTarget = i;
            if (iTargetVal == 0)
               break;
         }
      }
   }
   s_symColour[iTarget].m_cRef += 1;
   EnsureColour(iTarget);
   if (iTarget < 0 || iTarget >= iMac)
   {
      say ("Bad colour index returned in IGetNextSymColour: ":+iTarget);
   }
   return iTarget;

}


/* G E T  S Y M  H I G H L I G H T  C O L O U R */
/*----------------------------------------------------------------------------
   %%Function: GetSymHighlightColor
   %%Author: Setup the highlighting colour
   %%Owner: Setup the highlighting colour

   

----------------------------------------------------------------------------*/
static int GetSymHighlightColour(_str strKey)
{
   if (!s_keyColour._indexin(strKey))
   {
      s_keyColour:[strKey] = IGetNextSymColour();
   }
   else if (s_keyColour:[strKey] < 0 || s_keyColour:[strKey] >= s_symColour._length())
   {
      say ("index for '":+strKey:+"' out of range: ":+s_keyColour:[strKey]);
      s_keyColour:[strKey] = IGetNextSymColour();
   }
   else if (s_symColour[s_keyColour:[strKey]].m_cRef == 0)
   {
      say ("Hit recovery code in GetSymHighlightColour");
      s_keyColour:[strKey] = IGetNextSymColour();
   }


   return s_symColour[s_keyColour:[strKey]].m_ColourSymHighlight;   
}


/* D E F E R R E D  I N I T  S Y M  H I G H L I G H T */
/*----------------------------------------------------------------------------
   %%Function: DeferredInitSymHighlight
   %%Author: MarkSun
   %%Owner: MarkSun

   Start up our callback function.
   I do not know why deferring the init is good, I copied this from another
   macro.

----------------------------------------------------------------------------*/
static void DeferredInitSymHighlight()
{
   if ( !pos( "-mdihide", _editor_cmdline, 1, 'i' ) )
   {
      if ( s_markertypeSymHighlight < 0 )
         s_markertypeSymHighlight = _MarkerTypeAlloc();
      else
         _StreamMarkerRemoveAllType( s_markertypeSymHighlight );

      if ( s_timerSymHighlight >= 0 )
         _kill_timer( s_timerSymHighlight );

      _InitSymColour();
      _InitScrollMark();
      DoClearAllSymHighlightStructs();
      s_timerSymHighlight = _set_timer( def_sym_highlight_delay, SymHighlightCallback );
   }
}


/* D E F I N I T */
/*----------------------------------------------------------------------------
   %%Function: definit
   %%Author: MarkSun
   %%Owner: MarkSun

   Initialize this module.

----------------------------------------------------------------------------*/
definit()
{
   s_modtimeSymHighlight = -1;

   if (arg(1) != 'L')
   {
      s_timerSymHighlight = -1;
      s_markertypeSymHighlight = -1;
   }

   _post_call( DeferredInitSymHighlight );
}

_command void removeallscrollmarker() name_info(',')
{
   ClearAllSymHighlight();
}

_command void select_string() name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   typeless mypos;
   save_pos(mypos);
   if (_in_string()) {
      // find the start of the string
      while (_in_string()) {
         if (cursor_left_with_line_wrap()) {
            break;
         }
      }
      if (!_in_string())
         cursor_right_with_line_wrap();
   }
   else {
      // find first string on the line
      _begin_line();
      while (!_in_string()) {
         if (cursor_right_with_line_wrap()) {
            restore_pos(mypos);
            return;
         }
      }
   }
   // move off the leading quote
   cursor_right_with_line_wrap();
   _select_char();
   while (_in_string()) {
      if (cursor_right_with_line_wrap()) {
         break;
      }
   }
   cursor_left_with_line_wrap();
   _select_char();
   restore_pos(mypos);
}


marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #10 on: May 31, 2013, 06:30:16 PM »
I've incorporated chandlerzhang's ideas (thanks for them) into symhighlight.e

By default, scroll markers will be used, but if you do not wish to have them just run
set-var def_sym_highlight_use_scrollmarkers 0.  After doing so, the next highlighting you do will remove all scroll markers.
If you wish to have them back, do the same thing but with 1.  The next highlight you do will create all appropriate scroll markers.

Azethoth

  • Community Member
  • Posts: 10
  • Hero Points: 0
Re: Symbol Highlighting
« Reply #11 on: March 23, 2015, 01:06:00 AM »
Well done. This is faster and more useful than the built in matching which I turned off because it is ridiculously slow and limited to one thing.

I found two bugs:

1) On a restart I have to do remove all hilites (brings up dialog to remove an empty list of hilites). If this is not done SE crashes. Not sure what the interaction is that causes this. Background tagging?

2) If I select something and then hilite it, it does not hilite the selection but instead the next item.
So in
Code: [Select]
add("DATETIMEPERIOD", elementselecting DATETIMEPERIOD and then hiliting, it hilites "element" instead of all DATETIMEPERIOD.

3) Can the remove all hilites dialog be silenced? It is just not catastrophic to lose the hiliting by accident, and way too much hassle to have a prompt for removal.

4) Not nearly enough colors!

I modified it as follows:
   s_symColour[0].m_ColourSymHighlight = -1;
   s_symColour[0].m_rgb = _rgb(0xff, 0xff, 0x00);
   s_symColour[0].m_cRef = 0;
   s_symColour[1].m_ColourSymHighlight = -1;
   s_symColour[1].m_rgb = _rgb(0x00, 0xee, 0xee);
   s_symColour[1].m_cRef = 0;
   s_symColour[2].m_ColourSymHighlight = -1;
   s_symColour[2].m_rgb = _rgb(0xff, 0x00, 0xff);
   s_symColour[2].m_cRef = 0;
   s_symColour[3].m_ColourSymHighlight = -1;
   s_symColour[3].m_rgb = _rgb(0xff, 0x00, 0x00);
   s_symColour[3].m_cRef = 0;
   s_symColour[4].m_ColourSymHighlight = -1;
   s_symColour[4].m_rgb = _rgb(0x00, 0xff, 0x00);
   s_symColour[4].m_cRef = 0;

   s_symColour[5].m_ColourSymHighlight = -1;
   s_symColour[5].m_rgb = _rgb(0xbb, 0xbb, 0x00);
   s_symColour[5].m_cRef = 0;
   s_symColour[6].m_ColourSymHighlight = -1;
   s_symColour[6].m_rgb = _rgb(0x00, 0x88, 0x88);
   s_symColour[6].m_cRef = 0;
   s_symColour[7].m_ColourSymHighlight = -1;
   s_symColour[7].m_rgb = _rgb(0xbb, 0x00, 0xbb);
   s_symColour[7].m_cRef = 0;
   s_symColour[8].m_ColourSymHighlight = -1;
   s_symColour[8].m_rgb = _rgb(0xbb, 0x00, 0x00);
   s_symColour[8].m_cRef = 0;
   s_symColour[9].m_ColourSymHighlight = -1;
   s_symColour[9].m_rgb = _rgb(0x00, 0xbb, 0x00);
   s_symColour[9].m_cRef = 0;

This doubles the colors and makes the yellow darker so it matches the rest better.
« Last Edit: March 23, 2015, 03:54:27 AM by Azethoth »

guboogizz

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Symbol Highlighting
« Reply #12 on: May 06, 2015, 12:45:58 PM »
I manage source code in project. sometimes easy to find symbol, use macro(SymHighlight.e). but if I close project and reopen, Highlighted symbol is  canceled. so I am wondering How can I save Highlighted symbol list(SymHighlight.e user macro) ??

marksun

  • Community Member
  • Posts: 28
  • Hero Points: 5
Re: Symbol Highlighting
« Reply #13 on: May 19, 2015, 10:51:40 PM »
Here's an update that supports some of your wishes.
New configuration variables:
   set-var def_sym_highlight_confirm_clear
       lets you skip the confirmation dialog when clearing out the search list
   set-var def_sym_highlight_persist_across_sessions
       lets you start vs with the same search/highlights that you exited with

If you have text selected when you call ToggleSymHighlight it will use that text rather than the symbol under the cursor.
New command:  ToggleSymHighlightFullMatch will change the search from whole word match to partial word match and back again.

As for the crash reported, I haven't seen it but then again, I've kept tweaking this on my machine so it's possible I fixed it but never uploaded.

guboogizz

  • Junior Community Member
  • Posts: 3
  • Hero Points: 0
Re: Symbol Highlighting
« Reply #14 on: June 22, 2015, 06:56:36 AM »
Thank you, marksun
Due to your consideration, Macro is more useful to analyze source code
While using new version, I have not seen bug yet.
Have a good day~