Sublime Forum

Search and replace issues

#1

“Search & replace within a selection” has been borked for years. I’m using the Windows version.

It’s a really handy feature but it’s very frustrating to use. On the first run, Sublime will only replace the first occurrence in the selection and then it unselects everything.

Then, I have to reselect everything and try again. I feel like I may be experiencing multiple bugs surrounding the “search & replace within the selection” feature. It does not feel polished. It always takes multiple attempts to get the job done and I feel like I’m actively fighting Sublime when doing this.

It’s a powerful feature and I’m glad it’s there. Maybe it could use some TLC. This issue has existed forever so I’m assuming nobody else has reported it.

Thank for your making Sublime, it’s my favourite text editor.

0 Likes

#2

Any way you could provide a screen grab or recording? I am unable to reproduce this on MacOS at least

0 Likes

#3

Replacing text in a predefined region (selection) requires a certain workflow, which may not be possible with default settings.

Selection is transformed to a lookup-region, if find/replace panel is opened while in selection flag is set. All operations are performed on that region as long as find/replace panel keeps open.

grafik

Issues:

  1. default setting "auto_find_in_selection": false, causes the in selection flag to be unset, if a find/replace panel is opened. Thus selection is never transformed to a lookup region.

  2. The default setting "close_find_after_replace_all": true however causes the panel to close immediately after first “replace all” operation, so selection and lookup region are vanished.

Solution / Workaround:

Set the following settings

{
	"auto_find_in_selection": true,
	"close_find_after_replace_all": false
}

then …

  1. ensure find/replace panel is closed
  2. select a portion of text
  3. open find/replace panel
  4. keep the panel open while replacing things
  5. finally close the panel.

Note: It is really important to first select the text, as the lookup-region is only created with the “open find panel” event.

The proposed imporvement was to update the lookup-region also, if the In Selection flag is set or unset, so lookup region can be modified while find panel is open.

see:

1 Like