Replace - Scope switching from "Selected text" to "Global"

When the last replace happened with "Selected text" and text is selected when triggering replace again (Ctrl+R), sometimes the Scope switches from "Selected text" to "Global" (switch is actually visible).

I can reproduce it with the following text in Editor:


  1. Select the first x
  2. Ctrl+R
  3. Text to find: x
  4. Replace with: y
  5. Scope: Selected text
  6. [Replace All]
  7. [Close]
  8. Ctrl+R

Scope is now "Global" again.

Still happens with the newest version - can you reproduce this?

Looks like it goes to "Selected" only if more than one line is selected.

What might be the reason behind this behavior?

The person who would know is off this week, we'll have to wait.

I guess the idea is that if only one line is selected, that the selected text is more likely to be the "Text to find" and to be replaced in the whole file but if more than one line is selected, then the selection is used as Scope for replacement?

I tried this with Notepad++ and it does not make these assumptions - I find that easier to understand.

I usually only want to replace within the selected text (can still select the whole file if necessary), but if I select one word, open the replace dialog and then change the selection in the background to my expected scope, the option is already changed to "Global" and if I don't realize this then the whole file is used as scope regardless selection.

Now that I know how it works I should be able to work around this, but it has been less than obvious for me (for years) when and why this happens.

Sorry, Peter. I was away when you initially sent this and missed it. There's something goofy there, for sure. I think your initial example should have chosen Selected Text. I use (and love) NPP, but my one beef is with its lack of auto-selecting "In selection." Our Delphi IDE defaults to Selection when a selection is made which seems intuitive. I will look at this.