Sublime Forum

ST4: Use Selection for Find > Find Next gets stuck on regex match mode?

#1

I’ve noticed this happening frequently recently, but I’m not sure when it started or how to reproduce (ugh! the worst kind of bug report!): I often select a variable in PHP (e.g. $foobar) and cmd-e (Use Selection for Find), cmd-g (Find Next) to find the other occurrences, and nothing happens, even though I know there are other matches in that document.

If I select the text minus the $ it will work, but this isn’t ideal as sometimes it has matches I don’t want.

If I open the Find dialog, and turn on regex match mode, then turn it off again, it then works as expected. I can cmd-e, cmd-g on that $foobar variable and it works fine, and the behavior sticks across documents and projects until it randomly stops working again, requiring me to toggle regex match mode on & off again.

I do use regex match mode in Find every so often, but 95% of the time it’s off. And every time I run into this issue, when I open Find, it’s not turned on — but toggling it triggers the fix.

Anybody else seeing similar behavior? I’m on the ST4 dev channel, currently build 4131.

0 Likes

#2

I found a command I’ve never seen before, Quick Find (cmd-alt-g), which does work for what I need here (quickly find the next instance of selection, ignoring the regex status of Find). Although cmd-e, cmg-g is pretty hardwired for me as I use it all the time in other apps, I can rewire my brain to use Quick Find for ST4.

Some other weird behavior I’ve noticed that may be a clue: cmd-e will escape the $ for the selected text in the Find dialog if regex is enabled, but then it disappears as soon as you cmd-g (or click the Find button), and nothing is found as it’s searching for $data instead of \$data:

I do think something’s goofy in this area, and it’s definitely different from ST3/2, as I never ran into this before. I know this isn’t a huge deal, but it seems to point to something being a little haywire with search internals, so I brought it up.

0 Likes