Table of Contents

Class OutputBase

Namespace
Terminal.Gui.Drivers
Assembly
Terminal.Gui.dll

Abstract base class to assist with implementing IOutput.

public abstract class OutputBase
Inheritance
OutputBase
Derived
Inherited Members

Constructors

OutputBase()

Initializes a new instance of the OutputBase class and detects whether the output is attached to a real terminal device.

Properties

Force16Colors
IsAttachedToTerminal

Gets whether this output instance is attached to a real terminal device.

IsLegacyConsole

Methods

AppendCellAnsi(Cell, StringBuilder, ref Attribute?, ref TextStyle, int, ref int, ref int)

Appends ANSI sequences for a single cell to the output.

AppendOrWriteAttribute(StringBuilder, Attribute, TextStyle)

Changes the color and text style of the console to the given attr and redrawTextStyle. If command can be buffered in line with other output (e.g. CSI sequence) then it should be appended to output otherwise the relevant output state should be flushed directly (e.g. by calling relevant win 32 API method).

When a color is None (alpha = 0), the terminal's default foreground or background color is used via ANSI reset sequences (CSI 39m / CSI 49m), allowing native terminal transparency to show through.

BuildAnsiForRegion(IOutputBuffer, int, int, int, int, StringBuilder, ref Attribute?, Func<int, int, bool>?, bool)

Builds ANSI escape sequences for the specified rectangular region of the buffer.

GetLastOutput()

Gets a string containing the ANSI escape sequences and content most recently written to the terminal via Write(IOutputBuffer)

GetSixels()
SetCursorPositionImpl(int, int)

When overriden in derived class, positions the terminal draw cursor to the specified point on the screen. Note, this does NOT update any internal cursor position state - that is the responsibility of the caller.

ToAnsi(IOutputBuffer)

Generates an ANSI escape sequence string representation of the given buffer contents. This is the same output that would be written to the terminal to recreate the current screen contents.

Write(StringBuilder)

Output the contents of the output to the console.

Write(IOutputBuffer)

Writes dirty cells from the buffer to the console. Hides cursor, iterates rows/cols, skips clean cells, batches dirty cells into ANSI sequences, wraps URLs with OSC 8, then renders sixel images. Cursor visibility is managed by ApplicationMainLoop.SetCursor().