Crate input_mgr

source ·
Expand description

§Input Manager

Input manager is a ring-buffer based method of representing input and output of a system.

It intends to provide a similar function to a tty/terminal, but uses a “chat bubble” metaphor to distinguish from “local input” and “remote output”.

In a typical tty application, “Local” would correspond to stdin, and “Remote” would correspond to “stdout”.

It uses a fixed-size array of lines for storage, where each line can hold a dynamic number of characters. These lines can be cheaply reordered (using a separate index for the ordering of lines).

These lines are sorted into four distinct regions:

  1. “Local Editing Region” - or lines that the user is currently typing in, but have not submitted. This is like the text box in a chat program - it is not “latched in” until you hit the send button (or in our case, you submit the lines.
  2. “Remote Editing Region” - or lines that the computer is currently typing in, but has not submitted. This would be like if you could preview the message being written by someone else in a chat program, before they hit send.
  3. “History region” - A listing of the most recent lines that have been submitted. This is like the history of a chat window. Each line is tagged with its source, either from the local or remote end.
  4. Empty lines, that have never been used for local or remote input. Initially all lines are empty lines, however eventually most lines will end up being editing or history lines, and there will be no empty lines

When the local or remote end wants an additional line for editing, the history lines (or empty lines, if available) will be recycled to become

Structs§

Enums§