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

New Search Editor focuses results instead of query input when seeded (use focusResults: false by default) #105597

Closed
benalavi opened this issue Aug 28, 2020 · 1 comment
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue search-editor

Comments

@benalavi
Copy link

  • VSCode Version: 1.48.1
  • OS Version: Mac OS 10.14.6

Steps to Reproduce:

  1. Select text
  2. Open New Search Editor (either via command pallet or key binding)
  3. Cursor jumps to first line of results (summary info, i.e. 1 result - 1 file)

Does this issue occur when all extensions are disabled?: Yes/No

Yes


TL;DR: "focusResults": false might be a more expected default for Search Editor: New Search Editor

Expected Behavior: I expected that upon opening a Search Editor: New Search Editor the query term would be highlighted and the focus would remain on the query term. In the below screenshot I would expect "Foo" is highlighted and the query bar has focus.

Screen Shot 2020-08-28 at 7 41 56 AM

Note that when there is no highlighted text this is the behavior when opening a New Search Editor:

Screen Shot 2020-08-28 at 8 24 07 AM

I expected this behavior because it is the same behavior as the other two search cases:

Find:

Screen Shot 2020-08-28 at 8 01 14 AM

...and Search: Find in Files

Screen Shot 2020-08-28 at 8 03 21 AM

This often becomes an annoyance for me because of the following use case:

  • Have Search Editor: New Search Editor bound to Cmd+Shift+F
  • Working in a file, happen to have some highlighted text
  • Realize I might need to make some change in another file, open a New Search Editor w/ Cmd+Shift+F to find out
  • Highlighted text is searched for automatically
  • Start typing/paste what was on my clipboard thinking it will override the search term
  • End up inadvertently editing the search results
  • Press Esc to get back to the search query
  • Try typing/pasting again
  • Eventually try to close the New Search Editor and am modally prompted to save it because I inadvertently edited it earlier
  • Close the modal w/ mouse or Cmd+D (which I learned because of this, silver linings)

I believe this might be relatively recent behavior that was added w/ #95582 and/or #97823

Based on those I found that I could get the functionality I expected by setting "focusResults": false in keybindings.json, i.e:

    {
        "key": "shift+cmd+f",
        "command": "search.action.openNewEditor",
        "args": {
            "focusResults": false
        }
    }

...at which point I considered just not bothering posting an issue 😅 But because the behavior seems to be inconsistent I think "focusResults": false might be a more sensible default for search.action.openNewEditor.

Complete conjecture but I imagine the current behavior might have led to issues like: #105034 as my first instinct was to wonder why the search results were editable at all.

@JacksonKearl JacksonKearl added bug Issue identified by VS Code Team member as probable bug and removed bug Issue identified by VS Code Team member as probable bug labels Sep 8, 2020
@JacksonKearl
Copy link
Contributor

I think this makes sense, to be consistent with the other search widgets.

@JacksonKearl JacksonKearl added polish Cleanup and polish issue search-editor labels Sep 14, 2020
@JacksonKearl JacksonKearl added this to the September 2020 milestone Sep 14, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue search-editor
Projects
None yet
Development

No branches or pull requests

3 participants
@benalavi @JacksonKearl and others