Table of Contents

Class AnsiBackend

Namespace
MiniTui
Assembly
MiniTui.dll

The default backend: writes ANSI/VT escape sequences to standard output (§5.2–5.3). Uses the alternate screen, so the user's screen and scrollback are untouched.

public sealed class AnsiBackend : ITerminalBackend, IDisposable
Inheritance
AnsiBackend
Implements
Inherited Members

Constructors

AnsiBackend()

Create a backend for the detected color mode (Detect(ColorMode?)).

public AnsiBackend()

AnsiBackend(ColorMode)

Create a backend that downsamples colors to colorMode.

public AnsiBackend(ColorMode colorMode)

Parameters

colorMode ColorMode

Properties

ColorMode

The color mode colors are downsampled to.

public ColorMode ColorMode { get; }

Property Value

ColorMode

Methods

Dispose()

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

public void Dispose()

Draw(IReadOnlyList<CellUpdate>, (int X, int Y)?, bool)

Draw changed cells. Continuation cells are never included: a wide cell covers the cell to its right.

public void Draw(IReadOnlyList<CellUpdate> updates, (int X, int Y)? cursor, bool fullRedraw)

Parameters

updates IReadOnlyList<CellUpdate>

The changed cells.

cursor (int X, int Y)?

Where to show the cursor, or null to hide it.

fullRedraw bool

Clear the screen first; updates then contains every cell.

Enter()

Put the terminal into TUI mode (alternate screen, hidden cursor, ...). Idempotent.

public void Enter()

Exceptions

TerminalNotSupportedException

stdin or stdout is redirected.

GetSize()

The current terminal size in cells.

public (int Width, int Height) GetSize()

Returns

(int Width, int Height)

Leave()

Restore the terminal to how it was before Enter(). Idempotent and never throws.

public void Leave()