Skip to main content

Arlecchino.Input

Classes

TypeSummary
KeyTextTurns a key press into the character it should type. Take it as a constructor parameter instead of reading KeyPress.Character yourself — that is what keeps filters and shortcuts working on a non-latin layout.
TerminalInputReaderTurns 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.

Structs

TypeSummary
KeyBindingA key plus the exact modifiers that must be held with it, so Ctrl+S never fires on a bare S. It is added to with KeyBinding.AddAlternative and turned into a chord with KeyBinding.ThenKey.
KeyPressOne key press, as the framework hands it to a view. It is ConsoleKeyInfo with room for Command, which that type has nowhere to put.
KeyStrokeOne key and the modifiers held with it, which is the smallest thing a binding can be made of. A KeyBinding is one of these plus its alternatives and its finishing key.
MouseEventA mouse report from the terminal. Coordinates are frame cells — the same ones Surface.WriteAt and SurfaceRegion.Contains use, so hit-testing is comparing numbers.

Enums

TypeSummary
KeyModifiersModifiers held with a key. The three the console knows about keep the values ConsoleModifiers gives them, so the two agree bit by bit; KeyModifiers.Super is the one the console has no room for — Command on a Mac, the Windows key elsewhere.
MouseActionWhat the mouse did.
MouseButtonWhich button an event belongs to.
TextInputModeHow a key press becomes a character, which decides what happens on a non-latin layout.