TerminalInputReader class
Namespace: Arlecchino.Input · Assembly: Arlecchino
Turns what the terminal reports into keys and mouse events, reading an escape together with what follows it. Anything that turns out not to be a sequence is replayed key by key, after a short wait.
public sealed class TerminalInputReader
Constructors
| Member | Summary |
|---|---|
TerminalInputReader(IArlecchinoTerminal, InputRouter, ArlecchinoOptions) | Creates the reader, routing everything as it is read. Inside the framework it is built with a queue instead, so the reading thread never touches what the frame loop draws. |
Methods
| Member | Summary |
|---|---|
Read(KeyPress) | Handles one key press, reading further keys itself where it looks like the start of a sequence. An escape followed by another escape is Alt+Escape, which the runtime does not fold back together. |
ReadPending() | Reads everything waiting and returns, without blocking for more. Mouse events are drained too, since a terminal that reports them outside the key stream would otherwise pile them up. |
Constructors in detail
TerminalInputReader(IArlecchinoTerminal, InputRouter, ArlecchinoOptions)
public TerminalInputReader(
IArlecchinoTerminal terminal,
InputRouter router,
ArlecchinoOptions options);
Creates the reader, routing everything as it is read. Inside the framework it is built with a queue instead, so the reading thread never touches what the frame loop draws.
Parameters
| Name | Type | Description |
|---|---|---|
terminal | IArlecchinoTerminal | Where key presses come from. |
router | InputRouter | Where the result is sent. |
options | ArlecchinoOptions | Supplies how long to wait for the rest of a sequence. |
Methods in detail
Read(KeyPress)
public void Read(KeyPress key);
Handles one key press, reading further keys itself where it looks like the start of a sequence. An escape followed by another escape is Alt+Escape, which the runtime does not fold back together.
Parameters
| Name | Type | Description |
|---|---|---|
key | KeyPress | The key that was read. |
ReadPending()
public void ReadPending();
Reads everything waiting and returns, without blocking for more. Mouse events are drained too, since a terminal that reports them outside the key stream would otherwise pile them up.