Sublime Forum

Don't slurp Find string when moving from Find to Replace

#1
  1. Create a document with some text.

  2. Ctrl-F.

  3. Turn on Regexp.

  4. Type in find string “\w+”. The first word is selected (correct)

  5. Oops, I need to replace these with something. Press Ctrl-H

Expected: The “Find what” string should still be “\w+”
Actual: The “Find what” string picks up whatever was selected in the window, destroying your carefully-crafted regex.

I claim that if the Find UI is open switching to the Find/Replace UI should not change the “Find what” string.

The workaround is to press Esc to stop finding, move the cursor (to drop the selection), and then press Ctrl-H.

2 Likes

RegExp substituting