autexousious icon indicating copy to clipboard operation
autexousious copied to clipboard

Shell input improvement

Open azriel91 opened this issue 4 years ago • 0 comments

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 avatar Mar 12 '20 10:03 azriel91