Skip to content

TerminalWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

A widget that displays an embedded terminal session.

csharp
public sealed record TerminalWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<TerminalWidget>

Inheritance

ObjectHex1bWidgetTerminalWidget

Implements

Constructors

TerminalWidget(TerminalWidgetHandle)

A widget that displays an embedded terminal session.

Parameters:

csharp
public TerminalWidget(TerminalWidgetHandle Handle)

Properties

Handle

Returns: TerminalWidgetHandle

csharp
public TerminalWidgetHandle Handle { get; init; }

MouseWheelScrollAmount

Gets the number of rows to scroll per mouse wheel tick. Defaults to 3.

Returns: Int32

csharp
public int MouseWheelScrollAmount { get; init; }

Fields

CopyModeBufferBottom

Rebindable action: Move the copy mode cursor to the bottom of the buffer.

Returns: ActionId

csharp
public static readonly ActionId CopyModeBufferBottom

CopyModeBufferTop

Rebindable action: Move the copy mode cursor to the top of the buffer.

Returns: ActionId

csharp
public static readonly ActionId CopyModeBufferTop

CopyModeCancel

Rebindable action: Cancel copy mode without copying.

Returns: ActionId

csharp
public static readonly ActionId CopyModeCancel

CopyModeCopy

Rebindable action: Copy the selected text and exit copy mode.

Returns: ActionId

csharp
public static readonly ActionId CopyModeCopy

CopyModeDown

Rebindable action: Move the copy mode cursor down one row.

Returns: ActionId

csharp
public static readonly ActionId CopyModeDown

CopyModeLeft

Rebindable action: Move the copy mode cursor left one column.

Returns: ActionId

csharp
public static readonly ActionId CopyModeLeft

CopyModeLineEnd

Rebindable action: Move the copy mode cursor to the end of the current line.

Returns: ActionId

csharp
public static readonly ActionId CopyModeLineEnd

CopyModeLineStart

Rebindable action: Move the copy mode cursor to the start of the current line.

Returns: ActionId

csharp
public static readonly ActionId CopyModeLineStart

CopyModePageDown

Rebindable action: Move the copy mode cursor down one page.

Returns: ActionId

csharp
public static readonly ActionId CopyModePageDown

CopyModePageUp

Rebindable action: Move the copy mode cursor up one page.

Returns: ActionId

csharp
public static readonly ActionId CopyModePageUp

CopyModeRight

Rebindable action: Move the copy mode cursor right one column.

Returns: ActionId

csharp
public static readonly ActionId CopyModeRight

CopyModeStartSelection

Rebindable action: Start or toggle character selection in copy mode.

Returns: ActionId

csharp
public static readonly ActionId CopyModeStartSelection

CopyModeToggleBlockMode

Rebindable action: Toggle block/rectangular selection mode in copy mode.

Returns: ActionId

csharp
public static readonly ActionId CopyModeToggleBlockMode

CopyModeToggleLineMode

Rebindable action: Toggle line selection mode in copy mode.

Returns: ActionId

csharp
public static readonly ActionId CopyModeToggleLineMode

CopyModeUp

Rebindable action: Move the copy mode cursor up one row.

Returns: ActionId

csharp
public static readonly ActionId CopyModeUp

CopyModeWordBackward

Rebindable action: Move the copy mode cursor backward one word.

Returns: ActionId

csharp
public static readonly ActionId CopyModeWordBackward

CopyModeWordForward

Rebindable action: Move the copy mode cursor forward one word.

Returns: ActionId

csharp
public static readonly ActionId CopyModeWordForward

EnterCopyMode

Rebindable action: Enter copy mode for text selection.

Returns: ActionId

csharp
public static readonly ActionId EnterCopyMode

ScrollDownLine

Rebindable action: Scroll down one line in the scrollback buffer.

Returns: ActionId

csharp
public static readonly ActionId ScrollDownLine

ScrollDownPage

Rebindable action: Scroll down one page in the scrollback buffer.

Returns: ActionId

csharp
public static readonly ActionId ScrollDownPage

ScrollToBottom

Rebindable action: Scroll to the bottom, returning to the live terminal view.

Returns: ActionId

csharp
public static readonly ActionId ScrollToBottom

ScrollToTop

Rebindable action: Scroll to the top of the scrollback buffer.

Returns: ActionId

csharp
public static readonly ActionId ScrollToTop

ScrollUpLine

Rebindable action: Scroll up one line in the scrollback buffer.

Returns: ActionId

csharp
public static readonly ActionId ScrollUpLine

ScrollUpPage

Rebindable action: Scroll up one page in the scrollback buffer.

Returns: ActionId

csharp
public static readonly ActionId ScrollUpPage

Remarks

The TerminalWidget binds to a which provides the screen buffer from a running terminal session. This allows embedding child terminals within a TUI application.

When the terminal is not running (not started or completed), you can optionally provide a fallback widget using . This enables post-exit interactivity such as showing the exit code or a "restart" button.

Example usage:

csharp
var terminal = Hex1bTerminal.CreateBuilder()
    .WithPtyProcess("bash")
    .WithTerminalWidget(out var bashHandle)
    .Build();

_ = terminal.RunAsync(appCt);

ctx.Terminal(bashHandle)
   .WhenNotRunning(args => ctx.Text($"Exited with code {args.ExitCode}"));

Released under the MIT License.