Sublime Forum

In Selection not working in Find panel

#1

Thanks very much for the recent updates. I think Sublime 3 is awesome.

The “in selection” option in the Find and Find & Replace panel doesn’t work for me (Sublime 3102, Mac OS X El Capitan). When I uncheck “in selection”, it reports the number of matches of the whole document, but when I check “in selection” is just says the number of characters selected. When I click Find, a match isn’t found, even though there are clearly items to match in the selection. I’ve tried selecting the text first and then checking “in selection” and vise versa, neither seems to work.

It was working okay back in build 3095. In build 3099 (or maybe in 3198, I missed that update), it would report 1 match only, even though there were several matches in the selected text. Since 3100, it no longer reports any matches found in the selection.

Thanks for any help that you can provide.

0 Likes

#2

I found out that the “in selection” option in the Find or Find & Replace panel works only if the following steps are done in the following order:

  1. Select the text to search in document and copy to clipboard
  2. Select the range of text (selection) in document that you wish to limit the search to
  3. Bring up Find & Replace (or Find) panel
  4. Paste text in clipboard to Find What entry
  5. Click “in selection” in the panel

The order of the steps seems to matter. For example, if I do number 3 before number 2, Sublime doesn’t correctly limit the matches in the selected text.

Posting this just to help anyone trying to the use the “in selection” option.

0 Likes

#3

ST limits the search to the text that you had selected when you opened the panel. That’s an easy reason but may not be transparent to the user.

Imo the region to be searched should be highlighted by ST.

Probably relevant: https://github.com/SublimeTextIssues/Core/issues/191, https://github.com/SublimeTextIssues/Core/issues/999, https://github.com/SublimeTextIssues/Core/issues/641

2 Likes

#4

@FichteFoll Thanks for your reply and links.

The other issue is when using Replace All with “in selection”. Clicking Replace All causes the Find panel to disappear and the selection previously made in the document also disappears. If I’m doing just one replacement, that’s okay. But doing multiple replacements (with a different search and replace text for each replacement) for the same selection of text requires that the selection be redone each time.

0 Likes