Skip to content

Hex1bTerminalOptions

Namespace: Hex1b

Assembly: Hex1b.dll

Options for configuring a .

csharp
public sealed class Hex1bTerminalOptions

Inheritance

ObjectHex1bTerminalOptions

Properties

EscapeSequenceTimeout

How long to wait for additional bytes after a bare ESC (0x1B) before treating it as a standalone Escape key press. Traditional terminals use ESC as both the Escape key and the first byte of multi-byte ANSI sequences; this timeout disambiguates the two cases.

Returns: Nullable<TimeSpan>

csharp
public TimeSpan? EscapeSequenceTimeout { get; set; }

Height

Terminal height in rows. Used when no presentation adapter is provided. Default is 24.

Returns: Int32

csharp
public int Height { get; set; }

Metrics

Metrics instance for OpenTelemetry instrumentation. If null, is used.

Returns: Hex1bMetrics

csharp
public Hex1bMetrics? Metrics { get; set; }

PresentationAdapter

The presentation adapter for actual I/O (console, WebSocket, etc.). Pass null for headless/test mode.

Returns: IHex1bTerminalPresentationAdapter

csharp
public IHex1bTerminalPresentationAdapter? PresentationAdapter { get; set; }

PresentationFilters

Filters applied on the presentation side of the terminal. These see output going to the presentation layer and input from the user.

Returns: IList<IHex1bTerminalPresentationFilter>

csharp
public IList<IHex1bTerminalPresentationFilter> PresentationFilters { get; }

RunCallback

Optional callback that runs the workload and returns an exit code.

Returns: Func<CancellationToken, Int32>>

csharp
public Func<CancellationToken, Task<int>>? RunCallback { get; set; }

ScrollbackCallback

Optional callback invoked each time a row is scrolled off the top of the terminal into the scrollback buffer. Can be used for persistence or logging.

Returns: Action<ScrollbackRowEventArgs>

csharp
public Action<ScrollbackRowEventArgs>? ScrollbackCallback { get; set; }

ScrollbackCapacity

Maximum number of scrollback lines to retain. When null, no scrollback buffer is created (zero overhead). Default is null.

Returns: Nullable<Int32>

csharp
public int? ScrollbackCapacity { get; set; }

TimeProvider

The time provider to use for all time-related operations. Defaults to if not specified.

Returns: TimeProvider

csharp
public TimeProvider TimeProvider { get; set; }

Width

Terminal width in columns. Used when no presentation adapter is provided. Default is 80.

Returns: Int32

csharp
public int Width { get; set; }

WorkloadAdapter

The workload adapter that connects to the application generating output. Required.

Returns: IHex1bTerminalWorkloadAdapter

csharp
public IHex1bTerminalWorkloadAdapter? WorkloadAdapter { get; set; }

WorkloadFilters

Filters applied on the workload side of the terminal. These see raw output from the workload and input going to the workload.

Returns: IList<IHex1bTerminalWorkloadFilter>

csharp
public IList<IHex1bTerminalWorkloadFilter> WorkloadFilters { get; }

Remarks

This class provides a structured way to configure all aspects of a terminal, including dimensions, adapters, and filters for both workload and presentation sides.

csharp
var options = new Hex1bTerminalOptions
{
    Width = 80,
    Height = 24,
    WorkloadAdapter = new Hex1bAppWorkloadAdapter(),
    PresentationAdapter = new ConsolePresentationAdapter()
};
options.WorkloadFilters.Add(new AsciinemaRecorder());
var terminal = new Hex1bTerminal(options);

Released under the MIT License.