Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell input improvement #108

Open
azriel91 opened this issue Mar 12, 2020 · 0 comments
Open

Shell input improvement #108

azriel91 opened this issue Mar 12, 2020 · 0 comments
Labels
M: code Code maintenance and quality.
Milestone

Comments

@azriel91
Copy link
Owner

azriel91 commented Mar 12, 2020

In GitLab by @azriel91 on Mar 30, 2019, 13:55

At the time of writing, the input-handling branch of crossterm is in the works to provide an abstraction to make it easy to handle multi-line input.

We want to replace the ion copy and paste solution with this, so we don't have "it works when it works, but is difficult to understand what's wrong when you make a mistake".

Maybe use rustyline (repo).


Original problem: Reading multiple inputs per frame

In order to read multiple inputs per frame, we had to choose from:

  • Modify command to take in args for multiple events + change StdinMapper to read multiple events as return value.
  • Have a CommandSet StdinCommand, which indicates the number of commands to keep reading in StdinSystem and keep sending.
  • Figure out how to parse connectors in input.

We went with the last option, copying code from the ion shell. A side effect of this change is, we need to insert "#" instead of use blank lines to indicate "no input this frame", because:

  1. StdinReader reads everything from stdin really quickly, sending it to the channel.
  2. StdinSystem reads and sends one "command chain" each dispatcher.update()
  3. Blank lines no longer mean "nothing happened", but "just whitespace in the file".
  4. The "#" indicates "nothing happened this frame".
@azriel91 azriel91 added the M: code Code maintenance and quality. label Mar 12, 2020
@azriel91 azriel91 added this to the Backlog milestone Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M: code Code maintenance and quality.
Projects
None yet
Development

No branches or pull requests

1 participant