simon-v / bean-add

A beancount transaction entry assistant (GitHub mirror)
https://simonvolpert.com/bean-add/
Apache License 2.0
31 stars 2 forks source link

Allow cycling through the readline completion suggestions. #11

Closed pmarciniak closed 1 year ago

pmarciniak commented 1 year ago

Before this commit, after typing something and hitting TAB, readline would print all the matching words, but still require the user to fully type the remaining characters until there's only one matching completion. With this change, readline will still print all the matching words, but also allow cycling through them with TAB (or backwards with Shift-TAB) to quickly select the correct one without the need to type more characters.

simon-v commented 1 year ago

Overall, i like this change.

Does this work the same with both readline and libedit as the underlying completion library?

~Is it possible to make the first tab-press to print the options and the second one start cycling through them?~

~This interacts weird with completing from anywhere in the line originally introduced in 5e3bde7, producing unexpected, counterintuitive results. Reverting to the beginning-of-line-only completion makes the results more predictable, but loses a somewhat valuable bit of functionality. How could this be reconciled?~

Currently testing a tweak which makes it work just about right.

pmarciniak commented 1 year ago

Sorry for the delayed reply. No, I haven't verified if this works with libedit as the underlying library. I've only tested with readline.

Thank you for your tweak, I've just tested it. It makes my idea much better!