tty-reader icon indicating copy to clipboard operation
tty-reader copied to clipboard

Support Ctrl+A, Ctrl+E and Ctrl+W in `read_line`

Open jeremie-stripe opened this issue 3 years ago • 1 comments

Describe the problem

A potential suggestion/feeling check before I go ahead and try to contribute. We have a user of our CLI tool (which uses shiny TTY::Prompt) that was asking to be able to use the classic Ctrl combination for navigation and editing of a prompt.ask (Ctrl+A to go at the start of a line, Ctrl+E for end and Ctrl+W to erase the prefilled value).

How would the new feature work?

My instinct would be that we just need to add those 3 cases I mention in https://github.com/piotrmurach/tty-reader/blob/ac9257188cfd19f91f5386217ef29c218b9a83bd/lib/tty/reader.rb#L338-L339 to mirror the currently handling that's done with :home, :end and add one for erasing.

Drawbacks

Not sure if handling this would cause ripple effects through some other systems that expect it to be available.

jeremie-stripe avatar May 12 '22 19:05 jeremie-stripe

I guess the question is if this is an desired capability for tty-reader considering the text from the Readme: "The tty-reader is not compatible with the GNU Readline and doesn't aim to be. "

coezbek avatar Sep 27 '24 08:09 coezbek