Implement editing for the Ask function.
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 265
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Ask prompt and its integration with the dart_console package, then check how stdin is currently read in ANSI and non-ANSI terminals. Verify cursor movement, Delete, and Backspace in local, Docker, and SSH sessions, including the reported macOS behavior. Done means editing works where ANSI is available and the existing fallback remains usable otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100