dvorka / hstr

bash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
http://me.mindforger.com
Apache License 2.0
4.04k stars 231 forks source link

Use readline to edit the pattern #226

Open pknowles opened 7 years ago

pknowles commented 7 years ago

There are lots of little features such as a cursor position, home/end, delete-word, ctrl-arrows to move by words, which would take a lot of effort to replicate reliably. Switching to readline might be an easy way to add these features for free.

Using rl_callback_read_char in particular should allow the selection to be updated interactively: https://tiswww.case.edu/php/chet/readline/readline.html#SEC41

The pattern is currently built by looping over wgetch(), but it seems readline expects different control characters, i.e. from rl_getc(stdin). The painful part will be remapping the special characters to select matches and change options. I'll keep looking into it.

dvorka commented 6 years ago

This suggestions would solve a number of user enhancement requests - @pknowles thank you!

hugows commented 2 years ago

Anything about this?