New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entering text in find widget should not clear the selection #17563
Comments
@mfrost66 the find widget has received lots of input and I cannot reconstruct the history. All I wanted to point out, is that the scenario to replace inside a selection is supported. Changing the title and assigning to @alexandrudima for further comment. |
@mfrost66 |
@alexandrudima
I believe this to be standard behavior in mainstream editors. See MS excel, MS word, intellij, visual studio. Imagine if excel ignored (or modifed) your column selection when you did a search/replace. See intelli as an example of an editor that previews the match but honors the selection. Regarding visual studio, I haven't used it in several years but as of 2014, it definitely did not override or ignore my selection. Snapshot of webstorm search/replace in selection, note the highlight of the search match |
@alexandrudima It looks like the Find field is only set when starting Find/Replace if the current selection does not contain a space. How about only modifying the selection after the user clears the Find field then starts typing if the current Find is what set the selection? Or something else, but the ideal is definitely that it should not clear the selection in the case described here. |
I finally figured out how to use "find in selection", here are the steps for anyone googled here:
|
Nice to have workaround for basic use case 👍, but beware that even this currently suffers several bugs:
And to reiterate on this issue and unresolved issues merged here:
Overall, I think that it is a mistake to (ab)use selection as "search results highlight". FMPoV selection should be "sacred" and nothing but selection-related actions invoked by user should alter its presence and shape. Search results should be something different, and only explicit search-related commands like "Select all matches" or "Select next match" should amend the real selection. |
From @frostius:
From @myfonj:
I made a similar comment elsewhere before finding out that this issue existed. |
TL;DR - set |
🎉 |
@mario-d-s - I used to have it set to @myfonj - Well, it is certainly nice to have |
@jkyeung you do have a point, haven't looked at it that way yet. For some reason I'm not struggling that much with it when I change that setting. It's not ideal for sure so I hope the Code team will indeed fix this. It is quite set apart from the rest of the product in terms of quality. |
Another consequence of auto-selecting when doing a find is that a search with a partial but incorrect result (search for "hey" in a file that happens to have "hello") leaves a wrong partial result selected and therefore highlighted. This makes it seem like "he" in "hello" was a match for "hey". Exact Repro:
For more complex searches, this is very misleading. It would be nice if there was at least setting to not auto-select the find text. |
@evangrayk related #60977 |
Sorry for writing a comment hat is not productive. But I'd like to share that "search and replace in a selection" is an incredible source of frustration for me on a daily basis in VS Code. This current issue here seems to be one of the problems that create pain for me. I come from Sublime Text 3 where search and replace in a selection simply worked intuitively for me. Maybe it can serve as an inspiration. I don't know. I get that we also cannot break the workflow of people who got used to the current behavior. It's completely anecdotal, but I felt the need to vent about this here: https://gehrcke.de/2020/04/vs-code-i-cannot-quite-figure-out-how-to-search-and-replace-in-a-selection/. I want to say THANK YOU to all those users creating GIFs and repros for exactly these WTF moments that probably many people around the world experience. CC @myfonj |
To mitigate the problem described in this original issue, we have already added |
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: