ConsoleForge 0.3.0
Elm-architecture TUI framework for .NET 8
Loading...
Searching...
No Matches
ConsoleForge.Terminal.AnsiTerminal Class Referencesealed

Production ITerminal backed by Console. More...

Inheritance diagram for ConsoleForge.Terminal.AnsiTerminal:

Public Member Functions

void Clear ()
 Clear the internal output buffer (not the physical terminal).
void DisableMouse ()
 Disable mouse tracking. No-op if not enabled.
void Dispose ()
 Restores raw mode and alternate screen, completes the input observable, and disposes the SIGWINCH registration.
void EnableMouse (MouseMode mode=MouseMode.ButtonEvents)
 Enable terminal mouse tracking.Events arrive via Input as MouseInputEvent. No-op if already enabled or not supported.
void EnterAlternateScreen ()
 Enter alternate screen buffer (saves scroll-back).
void EnterRawMode ()
 Enter raw / no-echo mode.Keyboard events are delivered via Input without waiting for newline. Ctrl+C is delivered as KeyMsg, not SIGINT.
void ExitAlternateScreen ()
 Exit alternate screen buffer and restore previous content.
void ExitRawMode ()
 Restore cooked (normal) input mode.
void Flush ()
 Flush the buffered output to the physical terminal.Called by the renderer at most once per frame (≤60 fps).
void SetCursorPosition (int col, int row)
 Appends an ANSI cursor-position escape sequence (converts 0-based col/row to 1-based ANSI).
void SetCursorVisible (bool visible)
 Shows or hides the hardware cursor by writing directly to the terminal (bypasses the render buffer).
void SetTitle (string title)
 Set the terminal window title. No-op if not supported.
void Write (string ansiText)
 Write a pre-rendered ANSI string to the terminal output buffer.Does not flush to the physical terminal until Flush() is called.

Properties

int Height [get]
 Current terminal height in rows.
IObservable< InputEventInput [get]
 Observable stream of input events (keypresses, resize events).
int Width [get]
 Current terminal width in columns.

Events

EventHandler< TerminalResizedEventArgs >? Resized
 Raised when the terminal window is resized (SIGWINCH on Unix).
Events inherited from ConsoleForge.Terminal.ITerminal
EventHandler< TerminalResizedEventArgsResized
 Raised when the terminal is resized.

Detailed Description

Production ITerminal backed by Console.

Handles ANSI output, raw mode (Unix/Windows), alternate screen, and resize events. On Unix: raw mode via termios, resize via SIGWINCH. On Windows: raw mode via kernel32 console mode, resize via background polling thread.

Member Function Documentation

◆ Dispose()

void ConsoleForge.Terminal.AnsiTerminal.Dispose ( )

Restores raw mode and alternate screen, completes the input observable, and disposes the SIGWINCH registration.

Safe to call multiple times.

Property Documentation

◆ Input

IObservable<InputEvent> ConsoleForge.Terminal.AnsiTerminal.Input
get

Observable stream of input events (keypresses, resize events).

The runtime subscribes to this; application code does not.

Implements ConsoleForge.Terminal.ITerminal.


The documentation for this class was generated from the following file:
  • src/ConsoleForge/Terminal/AnsiTerminal.cs