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

Up/down arrow keys in the Find prompt are too error-prone #2169

Closed
jamesderlin opened this issue Jan 26, 2018 · 8 comments
Closed

Up/down arrow keys in the Find prompt are too error-prone #2169

jamesderlin opened this issue Jan 26, 2018 · 8 comments

Comments

@jamesderlin
Copy link

Summary

I often unwittingly press Up/Down while the Find prompt has keyboard focus in an attempt to navigate to a line adjacent to the match. Unfortunately, this results in searching for a different string in the Find history and makes me lose my place in the document. I then need to start my search over. Even though my search string is in the history, being forced to start my search over can be a huge penalty if I was wading through dozens or hundreds of matches.

Numerous other people have complained about this behavior as well: https://forum.sublimetext.com/t/up-down-arrow-keys-in-find-box/5741/16

Possible solutions

  • Make pressing Up/Down not perform the earlier search immediately and instead require pressing Enter.
  • Use Alt+Up/Alt+Down (or Ctrl+, whatever) to navigate Find history instead of Up/Down.
  • Making key bindings configurable for the Find prompt so that Up/Down arrow keys can be disabled (or changed to move the caret in the editor).

Expected behavior

Pressing Up/Down while the Find prompt has focus should not lose my place in the current document.

Actual behavior

Pressing Up/Down immediately searches for the previous/next item in the search history.

Steps to reproduce

  1. Show the Find prompt. (Find > Find)
  2. Type some string to search for.
  3. Type a different string to search for.
  4. Press Up.

Result:
The current line of the document changed to match against the search string from step 2.

Environment

  • Operating system and version:
    • Windows 7 SP1 x64
  • Sublime Text:
    • Build 3.0, build 3143
    • 64-bit
@keith-hall
Copy link
Collaborator

Possible duplicate of #180

@jamesderlin
Copy link
Author

I saw issue #180 before posting this, and I do not believe that it is the same thing. Issue #180 is about losing your search query when accidentally pressing up/down. This issue is about losing your place in the editor.

@keith-hall
Copy link
Collaborator

Just turn highlight matches off, no?

@jamesderlin
Copy link
Author

Ah, you are right. Turning off "Highlight matches" gives me the behavior I want (the first of my proposed solutions). I do think that it is very not obvious, though, so allowing the key bindings to be customized in the Find dialog would still be nice.

Turning off "Highlight matches" is definitely an acceptable workaround for me, especially since other matches are already highlighted from "match_selection": true.

@nemilya
Copy link

nemilya commented May 12, 2020

Is there is any solution to close find panel on cursor Up/Down? (I'm not using search history..)

Not working:

  { "keys": ["up", "down"], "command": "hide_panel", "args": {"cancel": true},
    "context":
    [
      { "key": "panel_visible", "operator": "equal", "operand": true }
    ]
  },  

By plugin?

Linux Mint 19.3, Submit Text 3.2.2, Build 3211

@FichteFoll
Copy link
Collaborator

FichteFoll commented May 13, 2020

@nemilya

  // The `panel` key doesn't support regex_contains, unfortunately,
  // so we have to duplicate the bindings for all panels.
  // Matching `incremental_find` also doesn't seem to work?
  // { "key": "panel", "operator": "regex_contains", "operand": "find" },
  { "keys": ["up"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "find" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["down"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "find" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["up"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "replace" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["down"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "replace" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["up"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "incremental_find" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["down"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "incremental_find" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["up"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "find_in_files" }, { "key": "panel_has_focus" }],
  },
  { "keys": ["down"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "find_in_files" }, { "key": "panel_has_focus" }],
  },

@nemilya
Copy link

nemilya commented May 14, 2020

Thanks for fast answer!

  { "keys": ["up"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "find" }, { "key": "panel_has_focus" }],
  },

Unfortunately doesnt work. Open find by Ctrl+F, press "Up" - move to previous element of history.

if change to any other key (f.e. "ctrl+space"):

  { "keys": ["ctrl+space"], "command": "hide_panel", "args": {"cancel": true},
    "context": [{ "key": "panel", "operand": "find" }, { "key": "panel_has_focus" }],
  },

it works - close panel.

@BenjaminSchaaf
Copy link
Member

Closing as this seems resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants