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

Recover search string after accessing search history #14174

Closed
Cerno-b opened this issue Sep 22, 2023 · 13 comments
Closed

Recover search string after accessing search history #14174

Cerno-b opened this issue Sep 22, 2023 · 13 comments

Comments

@Cerno-b
Copy link
Contributor

Cerno-b commented Sep 22, 2023

Description of the Issue

I think it would be store the contents of the search line edit, in case someone accidentally presses the down key while writing a search term.

Tested in 8.5.2

Current Behavior

  1. Enter search text
  2. Press down key (search text is replaced by history entry)
  3. Press up (nothing changes, original search text is lost)

This can be pretty annoying if you try to write a complex regex term only to accidentally hit arrow up instead of arrow left so you have to start over.

Expected Behavior

  1. Enter search text (draft is stored somewhere)
  2. Press arrow down
  3. Press arrow up (draft is restored, only if going up from the first history element)
@alankilborn
Copy link
Contributor

From someone who has fat-fingered the down key when I meant to hit left/right, this issue seems reasonable.

@donho
Copy link
Member

donho commented Sep 24, 2023

Do we have any similar request? If not, I prefer to not implement it.

@alankilborn
Copy link
Contributor

I have seen it at least once before, either here or more likely on the Community support site.
If you need me to, I will try to find it. If there's no interest, I won't bother.

@Yaron10
Copy link

Yaron10 commented Sep 24, 2023

There are two parts here:

  1. "only to accidentally hit arrow up instead of arrow left" & "fat-fingered the down key".
    - My first thought was: you can accidentally hit the DEL key and lose your complex regex (and yes, it's not quite the same).
  2. An option to save the search-term without executing a search.
    - This might be a bit unconventional, but can be useful.

As you understand.

@alankilborn
Copy link
Contributor

accidentally hit the DEL key and lose your complex regex

But this would require the text in the Find what box to be entirely selected first, and this would be rather a rare event for the user to find himself in.

@alankilborn
Copy link
Contributor

The OP has put forth a simple solution to a real problem. I like it; I like its simplicity. I like its unobtrusiveness to the user (no additional options/settings/controls). Having an "undo" for changes on Find what would also suffice, but this would necessitate a lot of code/change, AFAIK.

@Yaron10
Copy link

Yaron10 commented Sep 24, 2023

you can accidentally hit the DEL key and lose your complex regex (and yes, it's not quite the same).

You can also Undo. :)
Yes, it's not quite the same.

@Yaron10
Copy link

Yaron10 commented Sep 24, 2023

Another minor point:

Currently (master) the user can easily know if a search has been executed for the term in "Find what".
It might be slightly confusing with the proposed PR.

@alankilborn
Copy link
Contributor

can easily know if a search has been executed for

One would think that a user that has a fat-finger moment will remember it when he is saved by this feature, and will be sure to mentally note that one of the entries in the history is "unexecuted". And he'll be really glad to do so.

@Yaron10
Copy link

Yaron10 commented Sep 24, 2023

@alankilborn,

I 👍 your PR, and I'm not retracting it. :)
I was just sharing some thoughts here.

@Cerno-b
Copy link
Contributor Author

Cerno-b commented Sep 24, 2023

Do we have any similar request? If not, I prefer to not implement it.

@donho Would you share some info on your reluctance with it? Do you think the issue is not relevant or do you think the proposed solution has some flaws? I consider the issue to be an annoyance, but maybe my proposal could be improved.

Edit: After some back and forth, I have rephrased the whole issue to make it clearer that it's not necessarily about the history, but more about retrieving an unfinished search text.

Sorry for the mess.

@Cerno-b Cerno-b changed the title Store unsent search terms in the search history Recover search string after accessing search history Sep 25, 2023
@Cerno-b
Copy link
Contributor Author

Cerno-b commented Sep 27, 2023

@donho I created a PR that does what I initially wanted and takes into account your comments. Feels natural and the code changes are minimal.

@Cerno-b
Copy link
Contributor Author

Cerno-b commented Oct 2, 2023

@donho After your revert, I created a new PR that addressed the bug found by @alankilborn.

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