Sublime Forum

Why next search result stops being highlighted after replace

#1

I’m using the latest 2217 build of ST2 for Mac. I really love it and always recommend it to my colleagues and friends. But I have this little annoying problem with search results highlighting.

When I search for a keyword, it correctly finds them all, then highlights the first result with a nice very visible color (#FFEA8C in Monokai color theme). When I keep pressing on the “Find” button to highlight the next keyword occurrence, it correctly highlights with the same #FFEA8C color.

But when I press the “Replace” button, ST2 replaces the text then immediately scrolls to the next occurrence (which is cool) BUT DOES NOT highlight it. Why??? Actually it does, but with the same color as the background of the ST2, so there almost no visual difference between the normal text and the highlighted text.

How to fix this???

For an example, see this screenshot and try to find where the highlighted text is.

http://api.monosnap.com/image/download?id=50174456e4b01d62d7648df8

0 Likes

#2

Looks like during “find” Sublime uses find highlight color, but after a replace it uses the normal selection color. The find widget has focus, though, so the selection color is the even more muted un-focussed version.
Sounds like a bug to me.

In the meantime, you could change your selection color as a workaround… Open up your Monokai color theme and change

<key>selection</key> <string>#49483E</string>
to e.g.

<key>selection</key> <string>#FFE792</string>
or whatever.

0 Likes

#3

Has this been confirmed as a bug or that it’s slated to be changed?

It’s workable for me as I have the ‘line number’ highlighted when the cursor moves, but I can just barely see the text-to-be replaced.

thx

0 Likes

#4

Did you try editing your theme?

0 Likes

#5

This seems to be still a problem. Still a bug? Adzenith described the problem with precision … three years ago.

After replace, the highlight is a background color, making the new selection very difficult to see during repeated replace actions.

Bueller?

0 Likes

#6

Define inactiveSelection to be the same color as your findHighlight.
Found this info here.

2 Likes

#7

Still a problem in 2021. To me, this makes find/replace nearly unusable.

0 Likes

#8

This is no longer the case in Sublime Text 4; it seems to highlight the next match on replace just fine:

0 Likes

#9

That’s nice. But I can’t find a reference to version 4 anywhere on the SublimeText site, or any way to get it. The ideas posted in other discussions for how to adjust the color scheme aren’t working for me either – the file formats have completely changed, and doing the obvious changes in the new format don’t seem to do anything at all, so I presume the file locations or precedences have also changed. Is any of this documented anywhere?

-s

0 Likes

#10

ST4 is currently in “discrete beta” on the Discord (link in the pinned resources topic) and available to anyone that has an ST3 license; it hasn’t been made public on the web site yet, though mentions of it abound here on the forum, the tracker, reddit, etc.

The change to the color scheme works here:

The file you create needs to be in your User package, named after your current color scheme (but with the sublime-color-scheme extension even if you’re using a tmTheme) and minimally needs to look as here, which changes the inactive selection color to whatever color you provide.

Documentation on color schemes, how to augment them in a manner like the above, the various ways you can specify the colors to use can be found here: https://www.sublimetext.com/docs/color_schemes.html

1 Like