ConsoleForge 0.3.0
Elm-architecture TUI framework for .NET 8
Loading...
Searching...
No Matches
ConsoleForge.Terminal.ITerminal Interface Reference

Thin abstraction over a physical terminal. More...

Inheritance diagram for ConsoleForge.Terminal.ITerminal:

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 EnableMouse (MouseMode mode=MouseMode.ButtonEvents)
 Enable terminal mouse tracking.
void EnterAlternateScreen ()
 Enter alternate screen buffer (saves scroll-back).
void EnterRawMode ()
 Enter raw / no-echo mode.
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.
void SetCursorPosition (int col, int row)
 Move the terminal cursor to the given zero-based column and row.
void SetCursorVisible (bool visible)
 Show or hide the terminal hardware cursor.
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.

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< TerminalResizedEventArgsResized
 Raised when the terminal is resized.

Detailed Description

Thin abstraction over a physical terminal.

Production implementation: AnsiTerminal (uses System.Console + ANSI codes). Test implementation: VirtualTerminal (in-memory buffer, injectable input).

Member Function Documentation

◆ EnableMouse()

void ConsoleForge.Terminal.ITerminal.EnableMouse ( MouseMode mode = MouseMode.ButtonEvents)

Enable terminal mouse tracking.

Events arrive via Input as MouseInputEvent. No-op if already enabled or not supported.

Implemented in ConsoleForge.Terminal.AnsiTerminal.

◆ EnterRawMode()

void ConsoleForge.Terminal.ITerminal.EnterRawMode ( )

Enter raw / no-echo mode.

Keyboard events are delivered via Input without waiting for newline. Ctrl+C is delivered as KeyMsg, not SIGINT.

Implemented in ConsoleForge.Terminal.AnsiTerminal.

◆ Flush()

void ConsoleForge.Terminal.ITerminal.Flush ( )

Flush the buffered output to the physical terminal.

Called by the renderer at most once per frame (≤60 fps).

Implemented in ConsoleForge.Terminal.AnsiTerminal.

◆ Write()

void ConsoleForge.Terminal.ITerminal.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.

Implemented in ConsoleForge.Terminal.AnsiTerminal.

Property Documentation

◆ Input

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

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

The runtime subscribes to this; application code does not.

Implemented in ConsoleForge.Terminal.AnsiTerminal.

Event Documentation

◆ Resized

EventHandler< TerminalResizedEventArgs> ConsoleForge.Terminal.ITerminal.Resized

Raised when the terminal is resized.

On Unix, triggered by SIGWINCH. The runtime re-queries Width/Height and sends WindowResizeMsg.


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