IHex1bTerminalPresentationAdapter
Namespace: Hex1b
Assembly: Hex1b.dll
Presentation-side interface: Where rendered output goes TO and user input comes FROM. This is the "user side" of the virtual terminal - the actual display device.
public interface IHex1bTerminalPresentationAdapter : IAsyncDisposableProperties
Capabilities
Capability hints that inform optimization strategies.
Returns: TerminalCapabilities
TerminalCapabilities Capabilities { get; }Height
Current terminal height in rows.
Returns: Int32
int Height { get; }Width
Current terminal width in columns.
Returns: Int32
int Width { get; }Methods
EnterRawModeAsync(CancellationToken)
Enter raw mode for proper input capture.
Parameters:
ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask EnterRawModeAsync(CancellationToken ct = default)ExitRawModeAsync(CancellationToken)
Exit raw mode and restore normal terminal input handling.
Parameters:
ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask ExitRawModeAsync(CancellationToken ct = default)FlushAsync(CancellationToken)
Flush any buffered output immediately.
Parameters:
ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask FlushAsync(CancellationToken ct = default)GetCursorPosition()
Gets the current cursor position in the terminal. Returns (0, 0) if the position cannot be determined.
Returns: ValueTuple<Int32, Int32>
A tuple of (Row, Column), both 0-based.
(int Row, int Column) GetCursorPosition()ReadInputAsync(CancellationToken)
Receive input (keystrokes, mouse events as ANSI sequences) FROM the user.
Parameters:
ct(CancellationToken): Cancellation token.
Returns: ValueTask<Byte>>
Raw input bytes from the user, or empty when disconnected.
ValueTask<ReadOnlyMemory<byte>> ReadInputAsync(CancellationToken ct = default)WriteOutputAsync(ReadOnlyMemory<byte>, CancellationToken)
Write rendered output TO the presentation layer (display).
Parameters:
data(ReadOnlyMemory<Byte>): The output data to send to the display.ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask WriteOutputAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)Events
Disconnected
Raised when the presentation layer disconnects (e.g., terminal closed, WebSocket dropped).
Returns: Action
event Action? DisconnectedResized
Raised when the presentation layer is resized by the user.
Returns: Action<Int32, Int32>
event Action<int, int>? ResizedRemarks
This interface mirrors but for the opposite side of the terminal. While the workload adapter connects to the application generating output, the presentation adapter connects to the device displaying that output.
Implementations include: ConsolePresentationAdapter - Real console I/OWebSocketPresentationAdapter - Browser-based terminalLegacyConsolePresentationAdapter - Wraps existing ConsoleHex1bTerminal