Skip to main content

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

MemberSummary
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

MemberSummary
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

NameTypeDescription
terminalIArlecchinoTerminalWhere key presses come from.
routerInputRouterWhere the result is sent.
optionsArlecchinoOptionsSupplies 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

NameTypeDescription
keyKeyPressThe 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.