Skip to content

Support Ctrl+A, Ctrl+E and Ctrl+W in read_line #25

@jeremie-stripe

Description

@jeremie-stripe

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

elsif key_name.to_s =~ /ctrl_/
# skip
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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions