IHex1bTerminalPresentationFilter
Namespace: Hex1b
Assembly: Hex1b.dll
A filter that observes data flowing between the terminal and presentation layer.
public interface IHex1bTerminalPresentationFilterMethods
OnInputAsync(IReadOnlyList<AnsiToken>, TimeSpan, CancellationToken)
Called when input is received from the presentation layer.
Parameters:
tokens(IReadOnlyList<AnsiToken>): The parsed ANSI tokens from the input.elapsed(TimeSpan): Time elapsed since session start.ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask OnInputAsync(IReadOnlyList<AnsiToken> tokens, TimeSpan elapsed, CancellationToken ct = default)OnOutputAsync(IReadOnlyList<AppliedToken>, TimeSpan, CancellationToken)
Called when output is being sent to the presentation layer.
Parameters:
appliedTokens(IReadOnlyList<AppliedToken>): The applied tokens with their cell impacts.elapsed(TimeSpan): Time elapsed since session start.ct(CancellationToken): Cancellation token.
Returns: ValueTask<AnsiToken>>
The tokens to send to the presentation layer. Return the original tokens to pass through, or a modified list.
ValueTask<IReadOnlyList<AnsiToken>> OnOutputAsync(IReadOnlyList<AppliedToken> appliedTokens, TimeSpan elapsed, CancellationToken ct = default)OnResizeAsync(int, int, TimeSpan, CancellationToken)
Called when the terminal is resized by the presentation layer.
Parameters:
width(Int32): New width in columns.height(Int32): New height in rows.elapsed(TimeSpan): Time elapsed since session start.ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask OnResizeAsync(int width, int height, TimeSpan elapsed, CancellationToken ct = default)OnSessionEndAsync(TimeSpan, CancellationToken)
Called when the terminal session ends.
Parameters:
elapsed(TimeSpan): Total duration of the session.ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask OnSessionEndAsync(TimeSpan elapsed, CancellationToken ct = default)OnSessionStartAsync(int, int, DateTimeOffset, CancellationToken)
Called when the terminal session starts.
Parameters:
width(Int32): Initial terminal width.height(Int32): Initial terminal height.timestamp(DateTimeOffset): When the session started.ct(CancellationToken): Cancellation token.
Returns: ValueTask
ValueTask OnSessionStartAsync(int width, int height, DateTimeOffset timestamp, CancellationToken ct = default)Remarks
Presentation filters see: Output TO the presentation layer (after terminal processing)Input FROM the presentation layer (raw user input)
Use cases include: Render optimization (jitter elimination, batching)Output transformation (e.g., delta encoding)Input preprocessingNetwork protocol adaptation