atom / find-and-replace

Find and replace in a single buffer and in the project
MIT License
242 stars 219 forks source link

[enhancement] Remember current search pattern when scrolling past ones #991

Open Aerijo opened 6 years ago

Aerijo commented 6 years ago

Prerequisites

Description

Apologies if this has already been raised, I cannot find an issue for it.

When writing a search pattern, pressing the down arrow key allows you to clear the current entry. Unfortunately, doing so deletes the search pattern you've been typing, unless you already performed a search with it (in which case it's in the search history).

Normally, this is not important because you're supposed to press tab when moving to the replace field. However, I often finish writing my search pattern and think "OK, I want to move down to the replace field" and, naturally, I press the down arrow key without thinking.

I know I can change keyboard shortcuts, but I don't have a problem as such with them; it's the complete loss of a search term I was making that is the issue.

Steps to Reproduce

  1. Open a find and replace panel
  2. Type a really long* pattern like this is a really long pattern that took a long time to write
  3. Press the down arrow key
  4. Attempt to get back the long pattern you were actually trying to search for

* length is not important, but it's more frustrating with longer / more complicated ones.

Expected behavior: [What you expect to happen] I would expect the current search term to be stored in the history, or at least recoverable in some way immediately after accidentally deleting it.

Actual behavior: [What actually happens] This pattern is just forgotten/deleted.

Reproduces how often: [What percentage of the time does it reproduce?] 100%

Versions

Atom : 1.23.3 Electron: 1.6.15 Chrome : 56.0.2924.87 Node : 7.4.0

apm 1.18.12 npm 3.10.10 node 6.9.5 x64 atom 1.23.3 python 2.7.10 git 2.14.3

find-and-replace@0.215.0

Additional Information

Maybe the side arrow keys could be used? And when another character is typed, this temporary history could be deleted.

E.g., a flow might be:

  1. Type search term
  2. Press down arrow key (deletes term)
  3. Press right arrow (->) key to "pull" back the deleted term, or
  4. Type any character to delete this temporary storage and continue like normal

This way, the occasional slip while trying to find and replace is easily recoverable.

Aerijo commented 6 years ago

This issue is not so important now I realise undo works. If that's grounds for closing, that's fine by me. I still feel a sideways arrow key would be more in line with the other manipulations that can be done with the up and down arrow keys.