Table of Contents

Class Terminal

Namespace
MiniTui
Assembly
MiniTui.dll

Manages the actual terminal - handles double-buffering and efficient rendering. Only changed cells are sent to the ITerminalBackend.

public class Terminal : IDisposable
Inheritance
Terminal
Implements
Inherited Members

Remarks

Terminals share a process-wide session: creating a Terminal while another is active (for example, an app started from inside another app) reuses it, and the outer terminal redraws fully on its next frame. The terminal is restored when the last one is disposed.

Constructors

Terminal()

Create a terminal on the default backend: AnsiBackend, or LegacyConsoleBackend on Windows consoles without VT support. Enters the alternate screen unless a terminal session is already active.

public Terminal()

Exceptions

TerminalNotSupportedException

stdin or stdout is redirected.

Terminal(ITerminalBackend)

Create a terminal on a specific backend, such as TestBackend.

public Terminal(ITerminalBackend backend)

Parameters

backend ITerminalBackend

Properties

Area

The full terminal area as a Rect.

public Rect Area { get; }

Property Value

Rect

Height

Terminal height in cells.

public int Height { get; }

Property Value

int

Width

Terminal width in cells.

public int Width { get; }

Property Value

int

Methods

CheckResize()

Check if terminal was resized. If so, recreates buffers and returns true.

public bool CheckResize()

Returns

bool

Dispose()

Dispose the terminal. The last terminal in the session restores the original console state.

public void Dispose()

Draw(Action<Buffer>)

Main render method. Pass a function that draws to the buffer.

public void Draw(Action<Buffer> render)

Parameters

render Action<Buffer>

Invalidate()

Force a complete redraw next frame (useful after terminal resize).

public void Invalidate()