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()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

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.

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<TInputRecord>.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.

RaiseMouseEventParsed(Mouse)

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

RaiseSyntheticMouseEvent(Mouse)

Events

AnsiSequenceSwallowed

Event raised when an unrecognized ANSI escape sequence is ignored.

KeyDown

Event raised when a key down event is dequeued.

MouseEventParsed

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

SyntheticMouseEvent

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