Skip to content

Implement editing for the Ask function. #161

@bsutton

Description

@bsutton

We regularly get requests to support editing when a user is entering input into the ask function.

It would be great if we could support the following edit functions in the Ask prompt

cursor left/right
del key
backspace (already supported on most terminals).

These functions are likely to only work when the terminal supports ansi escape sequences.

As such we need to work out what to do when an ansi terminal isn't available (presumable drop back to the current support of just backspace).

We currently use the dart_console package for handling a no. of the terminal functions. It would be my preference that we keep using this package.

Dart also sometimes incorrectly reports whether we have an ansi terminal. Do we need a method to force ansi support even when Dart doesn't detect it?

Scenarios that I would like to see supported is using ask in:

  • a docker terminal (e.g. you connect to a docker cli and then run a dart script).
  • an ssh session

We have also had a report that the backspace character doesn't work on some mac terminals. This may be because we are using linemode when reading from stdin. This issue may also fix that problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions