Skip to content
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

Pressing Cmd-F overwrites find text even if nothing is selected. #10386

Closed
edmundmk opened this issue Aug 10, 2016 · 8 comments
Closed

Pressing Cmd-F overwrites find text even if nothing is selected. #10386

edmundmk opened this issue Aug 10, 2016 · 8 comments
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) editor-find Editor find operations
Milestone

Comments

@edmundmk
Copy link

  • VSCode Version: 1.4.0
  • OS Version: OSX 10.11.6

Steps to Reproduce:

  1. Enter some find text.
  2. Press enter.
  3. Edit the text in the document.
  4. Press Cmd-F to repeat the search.
  5. Notice that the text in the find box has been replaced with the word the cursor is over.

This is really annoying when doing repeated find-edit cycles.

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug editor-find Editor find operations labels Aug 12, 2016
@alexdima alexdima added this to the Backlog milestone Aug 12, 2016
ramamurthynagaraj pushed a commit to ramamurthynagaraj/vscode that referenced this issue Aug 25, 2016
@ramamurthynagaraj
Copy link

Hi guys, created a PR for this issue. Let me know if there are any issues.

@alexdima
Copy link
Member

@edmundmk Rather than jumping and changing the seeding behaviour of ctrl+f, I am wondering if in step 4 for you , f3 would be a more suitable shortcut. If you want to repeat the search, f3 will take you to the next search hit without even losing focus in the editor.

@alexdima
Copy link
Member

@edmundmk Here I am using F3. Is this the sort of thing you are trying to do?

f3

@ramamurthynagaraj
Copy link

@alexandrudima I was taking sublime as a reference. The seeding doesn't happen even with the first cmd+f. Both vscode and sublime has cmd+d to seed the current focused word, which can suit your fav #10969 (comment) use case.

I think find next/previous shortcut should suffice @edmundmk use case.
I personally use cmd+f to bring the focus to find widget to make further refinements in the find text. Any thoughts on this?

@alexdima
Copy link
Member

@ramamurthynagaraj That is a fair point. Maybe we can change the behaviour to the following:

Seed the search string on ctrl+f if:

The rationale:

  • if the editor has no selected text (collapsed cursor) then the search text does not get overwritten
  • if the editor has selected text:
    • it could be that the find widget selected that text (imagine searching for \w+ in regex mode). If the selection is a find match, then the contents of the selection should not be used to seed the search text
    • otherwise, it is very likely that the selection was "manually"/"intentionally" created and is a good indicator that it can be used to seed the search text.

@ramamurthynagaraj
Copy link

@alexandrudima I think your proposed behaviour is better.
Let me see if I could implement the second point.

@ramamurthynagaraj
Copy link

@alexandrudima Created a new PR incorporating your suggestion. Please let me know if there are any issues.
Also was trying to add tests at findController.test.ts. It doesn't seem to be running with ./scripts/test.sh. How do we run those tests?

@rebornix
Copy link
Member

Dup of #20768 and we already added an option for seedSearchStringFromSelection.

@rebornix rebornix added the *duplicate Issue identified as a duplicate of another issue(s) label May 23, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) editor-find Editor find operations
Projects
None yet
4 participants