hstr icon indicating copy to clipboard operation
hstr copied to clipboard

Preselect the first matching history line?

Open Heart1010 opened this issue 11 years ago • 9 comments

Hi,

wouldn't it be so much easier/better when hstr would preselect the first line/occurence of the searched string? Example: I search for pull and get all the search results shown correctly in hstr but I always have to use the cursor down key to select the first search result.

Can you select the the first search result (instead of now the gray "- HISTORY - view:ranking..." line?

hh

Thanks

Heart1010 avatar Aug 12 '14 07:08 Heart1010

+1

s-hell avatar Aug 12 '14 08:08 s-hell

Make sense!

dvorka avatar Aug 20 '14 08:08 dvorka

+1!

tbabej avatar Oct 03 '14 14:10 tbabej

This should be in v1.15, shouldn't it?

So I start with "hh" to bring hstr to my shell (blank search), then I type "teamv" and as you can see the first occurence is not selected. Am I doing something wrong!?

hstr

Heart1010 avatar Jan 09 '15 12:01 Heart1010

If you press ENTER, the first line will get executed. It's true it's not highlighted, but it's debatable if it should be.

tbabej avatar Jan 09 '15 12:01 tbabej

@tbabej Ah ok... got it.

(highlighting the line would be "a nice to have" visible thing imho... the implementation now is not intuitive, I never had pressed enter in this stage/highlighting when you haven't told me that g)

Heart1010 avatar Jan 09 '15 12:01 Heart1010

I think that you are right Hermann - once you start typing, the first row will be highlighted to indicate that this is what will be used on ENTER or ctrl-right (nothing will be highlighted only if prompt is empty).

dvorka avatar Jan 09 '15 12:01 dvorka

Actually I just determined that there is inconsistent behavior (needs to be fixed):

  • ENTER - execute the first line
  • LEFT - open the first line in editor for customization (fix command)
  • RIGHT - take what's in the prompt (not the first line!) and show it on command line (not executed), BUT it should show the first line for editation i.e. this is a defect.

Proposed solution/fixes:

  • the first line to be highlighted all the time
  • RIGHT shows the first line (not what's in the prompt)
  • LEFT (fix command) shows the first line when filter pattern (prompt) is empty

Conclusion: filter pattern is not something to be executed, rather it is just a token to filter, therefore it makes no sense to pass it to command line + the first highlighted line indicates what is actually going to happen on ENTER/LEFT/RIGHT.

dvorka avatar Feb 24 '15 06:02 dvorka

I thought his would be really useful too, pull request in to add it in:

https://github.com/dvorka/hstr/pull/357

keithwhite avatar Sep 10 '19 22:09 keithwhite