Sublime Forum

Find and Replace in selection simply doesn't work

#1

It just doesn’t work or it is NOT intuitive at all.

Sublime Text 3 3083, Windows, Linux.

0 Likes

#2

Hello,

Well, it works, although I agree there is one point which may make it lack intuitiveness.

I’m attaching screen shots, into a single image, below (note I’m running Ubuntu, as I unfortunately don’t have any Windows of any version any‑more). Here are the explanations of all the screen shot:

  1. Pasted some text in a new tab.

  2. Selected some text.

  3. Ctrl+H pressed. Note the tiny icon pointed to by an arrow. This icon tells it does not apply to selection by default, as it is not pressed.

  4. At that point, the selection remains visible, just that it’s outlined instead of being highlighted.

  5. Remember the tiny icon above, standing for “In selection”? Here, it is pressed, and a simple “a” was typed in the search‑for field.

  6. Note the “a” found in selection are outlined, but the original selection does not appears, and that’s what may make you feel it’s not intuitive (is it this reason?). The original selection still applies, as you can notice the “a” are not outlined in the whole text, just inside the original selection.

  7. An uppercase “A” was typed in the replacement field and “Replace all” was clicked.

0 Likes

#3

I guess you may also like to add this in your User Preferences:

"auto_find_in_selection": true,

This will make find/replace more intuitive.

0 Likes

#4

Or this key binding, to toggle it:

[code]
// toggle selection in find panel
{ “keys”: “alt+s”], “command”: “toggle_in_selection”, “context”:

  { "key": "setting.is_widget", "operator": "equal", "operand": true }
]

},[/code]

0 Likes

#5

I think some characters might be missing from this snippet. I can’t get it to save.

0 Likes

#6

Apparently some posts from prior to when the underlying forum software changed are missing some [ characters (this came up just a day or two ago).

The corrected snippet of code for your key bindings would be:

  // toggle selection in find panel
  { "keys": ["alt+s"], "command": "toggle_in_selection", "context": [
      { "key": "setting.is_widget", "operator": "equal", "operand": true }
    ]
  },
0 Likes

#7

Can I ask why you came looking for this thread? I’m wondering whether you’re not experiencing behaviour that I am, in which case it would confirm a bug.

0 Likes