Author Topic: Find in files search results (changing markup)  (Read 2676 times)


  • Community Member
  • Posts: 13
  • Hero Points: 0
Find in files search results (changing markup)
« on: July 30, 2009, 08:51:47 pm »
I did a bit of searching of find in files and didn't see an answer to this, so quick question for you all:

When I do a find in files, the results are marked up as follows:
File name -> highlighted dark grey
search term -> highlighted dark grey

How can I change this to say:
1. Highlight file name a different color than the search term
2. Or prevent the file name from being highlighted. (maybe add a carriage return before it instead)
3. prepend the filename to the search hit. For instance, instead of the results:
     12 63:    int x = 0;
It would be:
    foo\bar.cpp(12): int x = 0;

Thanks in advance...

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Find in files search results (changing markup)
« Reply #1 on: July 30, 2009, 09:53:28 pm »
Changing the colors is easy:
1) Select Tools > Options > Appearance > Colors
2) Find the "Highlighting" node and set the colors for "Filename" and "Highlight".

!!Warning: I can't tell you all the places those colors are used.

Changing the format of the result requires editing the macro code.


  • Community Member
  • Posts: 13
  • Hero Points: 0
Re: Find in files search results (changing markup)
« Reply #2 on: August 20, 2009, 07:41:10 pm »
Thanks. That did work.

One more question,
When I run find-in-files, with append checked, I would like to separate each search with an extra new line (or better by changing the font of the search command in some way).

I was looking through the macro code, and tried changing _mffind2util. In particular, I added
   _str breakline = "================================================================";
But that didn't work. Not to mention, this is a pretty ugly hack.

Ideally, I would like to both add a newline and change the font of the "topline" to something BOLD.
Is there a way to do this?


  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1247
  • Hero Points: 125
Re: Find in files search results (changing markup)
« Reply #3 on: August 20, 2009, 09:05:24 pm »
There are two code-paths for Find in Files, one for Foreground and one for Background searches, :(.  Your change would only affect foreground only searches.  You can toggle the Foreground search option on the Find in Files and see your change might work as intended.  You can find the other entry point in bgsearch.e (start_bgsearch).

To make the top-line bold, you would have to add a stream marker to the text.  The easiest way would be to use _SetTextColor(), which is what we use to mark Files and Matches in the search results already.   You could use an existing color index that was already bold or create a new color index with _AllocColor().

Unfortunately we have no current facility to customize the view the way you want for Search Results, so macro modification is the only way to do it.