Replace deletes all text in a selection

Is this what’s supposed to happen?
Hit Replace and…

Well, yes and no. Yes, “Replace” just replaces the selected text; you want to use “Replace All” to maintain the selection and replace all instances of the search term within the selection. But “Replace” in this case should be disabled since what it does is pretty clearly not what you want when dealing with a selection of text.

Wait, so when you choose ‘Selected Text’ in the ‘Replace All Scope’ box, you’re asking the program to “Replace all of the selected text with the ‘Replace’ term”?

Doesn’t it mean ‘Within the selected text, find the "Find’ term and replace it with the ‘Replace’ term"? And hitting ‘Replace’ button does this once, hitting ‘Replace All’ does it to all instances.

It means that the scope of “replace all” is the selected text, that it will find and replace all instances of the search term within the selected text. The scope has nothing to do with the “Replace” button; that always replaces the selected text with the term, and the problem here is just that when there is an editor selection that is not the search term, “Replace” should not be available.

“Find” within the selection isn’t really applicable because using Find will just move to the next instance of the search term and select it, losing the initial selection. Thus the scope is specifically for “Replace All”.