hstr
hstr copied to clipboard
Use readline to edit the pattern
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.
This suggestions would solve a number of user enhancement requests - @pknowles thank you!
Anything about this?