Preselect the first matching history line?
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?

Thanks
+1
Make sense!
+1!
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!?

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 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)
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).
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.
I thought his would be really useful too, pull request in to add it in:
https://github.com/dvorka/hstr/pull/357