Table of Contents

Class InputProcessorImpl<TInputRecord>

Namespace
Terminal.Gui.Drivers
Assembly
Terminal.Gui.dll

Base implementation for processing queued input of type TInputRecord. Translates driver-specific input into Terminal.Gui events and data models on the main loop thread.

public abstract class InputProcessorImpl<TInputRecord> : IInputProcessor, IDisposable where TInputRecord : struct

Type Parameters

TInputRecord

The driver-specific input record type (e.g., ConsoleKeyInfo).

Inheritance
InputProcessorImpl<TInputRecord>
Implements
Derived
Inherited Members

Constructors

InputProcessorImpl(ConcurrentQueue<TInputRecord>, IKeyConverter<TInputRecord>, ITimeProvider?)

Initializes a new instance, wiring parser events and configuring the input queue.

Properties

ExternalCancellationTokenSource

External cancellation token source for cooperative cancellation.

InputImpl

Input implementation instance. Set by IMainLoopCoordinator.

InputQueue

Thread-safe input queue populated by IInput<TInputRecord> on the input thread. Dequeued by ProcessQueue() on the main loop thread.

KeyConverter

Translates driver-specific TInputRecord to Terminal.Gui Key.

Methods

Dispose()
GetParser()

Gets the ANSI response parser for handling escape sequences.

InjectKeyDownEvent(Key)

Injects a key down event. For unit tests.

InjectMouseEvent(IApplication?, Mouse)

Enqueues a mouse event. For unit tests.

IsValidInput(Key, out Key)

Validates and processes Unicode surrogate pairs in the input stream.

OnKeyboardEventParsed(Key)

Called when the ANSI parser raises a keyboard event before it is forwarded to KeyDown or KeyUp subscribers.

Process(TInputRecord)

Processes a single input element dequeued from InputQueue. Called sequentially for each dequeued value.

ProcessAfterParsing(TInputRecord)

Processes input that bypasses the Terminal.Gui.Drivers.InputProcessorImpl`1.Parser (e.g., stale escape sequences).

ProcessQueue()

Drains the input queue, processing all available input. Must be called on the main loop thread.

RaiseKeyDownEvent(Key)

Raises the KeyDown event after a key down event is dequeued.

RaiseKeyUpEvent(Key)

Raises the KeyUp event after a key release event is dequeued.

RaiseMouseEventParsed(Mouse)

Raises the MouseEventParsed event after a mouse event is parsed from the driver.

RaisePasteEvent(string)

Raises the Paste event. For unit tests and driver implementations.

RaiseSyntheticMouseEvent(Mouse)
ShouldSuppressFallbackKeyDown(Key)

Gives derived processors a chance to suppress keydown events that come from fallback stream processing after ANSI parsing.

Events

AnsiSequenceSwallowed

Event raised when an unrecognized ANSI escape sequence is ignored.

KeyDown

Event raised when a key down event is dequeued.

KeyUp

Event raised when a key is released.

MouseEventParsed

Event raised when a mouse event is parsed from the driver. For debugging and unit tests.

Paste

Event raised when bracketed paste content is delivered. The string contains the raw pasted text with the ANSI bracketing markers stripped.

SyntheticMouseEvent

Event raised when synthetic mouse events (clicks, double-clicks, triple-clicks) are generated.