KetraTerm
API · DevelopmentAll versions

TerminalReader

interface TerminalReader

Zero-allocation read contract for the terminal buffer.

Exposes viewport-relative state plus random-access helpers for the currently active screen buffer. Out-of-bounds probes never throw; they return stable sentinel values so renderers can remain branch-light. Serialize reads with terminal mutations; returned TerminalLine views borrow live storage and must not escape that serialization.

Inheritors

Properties

Link copied to clipboard
abstract val cursorCol: Int

Active cursor column in zero-based viewport coordinates.

Link copied to clipboard
abstract val cursorRow: Int

Active cursor row in zero-based viewport coordinates.

Link copied to clipboard
abstract val height: Int

Current viewport height in rows.

Link copied to clipboard
abstract val historySize: Int

Number of retained off-screen history lines in the active buffer.

Link copied to clipboard
abstract val iconTitle: String

Active xterm icon title.

Link copied to clipboard

Actual active screen. Read synchronously under the same serialization as terminal mutations.

Link copied to clipboard

Current immutable effective palette, including application color overrides. Reading retains the existing object without allocating or reading a render frame. Synchronize with terminal mutations before reading; a retained palette remains safe to use after releasing that synchronization.

Link copied to clipboard
abstract val width: Int

Current viewport width in cells.

Link copied to clipboard
abstract val windowTitle: String

Active xterm window title.

Functions

Link copied to clipboard
abstract fun getCodepointAt(col: Int, row: Int): Int

Returns the display/base codepoint at [col, row].

Link copied to clipboard
abstract fun getLine(row: Int): TerminalLine

Returns the visible line at row, or a shared void line when row is out of bounds.