TerminalRenderCache

class TerminalRenderCache(columns: Int, rows: Int, rowCapacityReserve: Int) : TerminalRenderFrameConsumer

Caller-owned primitive cache for render frames.

This cache consumes TerminalRenderFrameReader and stores copied primitive row data after the frame callback returns. It deliberately contains no backend-specific glyph runs, font state, paint objects, selection model, or UI timer logic. Swing, Compose, and other renderers can build their local layout and paint caches from this primitive data.

Cell and row planes may have spare capacity when rowCapacityReserve is non-zero. Only the prefix addressed by columns and rows is part of the current frame. The reserve lets renderers change a viewport's logical row count, for example while smooth-scroll overscan is active, without replacing the primitive arrays in the frame-update hot path.

Parameters

columns

initial cache width in cells.

rows

initial cache height in rows.

rowCapacityReserve

spare rows retained whenever primitive storage is allocated; must be non-negative.

Constructors

Link copied to clipboard
constructor(columns: Int, rows: Int, rowCapacityReserve: Int)
constructor(columns: Int, rows: Int)

Creates a cache whose primitive planes exactly fit its initial shape.

Properties

Link copied to clipboard

Last copied active buffer kind.

Link copied to clipboard

Copied primary public render attribute words in row-major order.

Link copied to clipboard

Packed codepoint storage referenced by clusterRefs.

Link copied to clipboard

Copied cluster references in row-major order. Zero means no cluster; other values pack a codepoint offset in the high 32 bits and a codepoint length in the low 32 bits.

Link copied to clipboard

Copied code words in row-major order. See TerminalRenderFrame.copyLine.

Link copied to clipboard

Cached visible width in cells.

Link copied to clipboard

Convenience cursor snapshot for tests and compatibility callers.

Link copied to clipboard

Last copied cursor blinking mode.

Link copied to clipboard

Whether the most recent updateFrom call changed the cursor state.

Link copied to clipboard

Last copied cursor column.

Link copied to clipboard

Last copied cursor generation.

Link copied to clipboard

Last copied cursor row.

Link copied to clipboard

Last copied cursor shape.

Link copied to clipboard

Last copied cursor visibility.

Link copied to clipboard

History lines discarded due to capacity wrapping since initialization.

Link copied to clipboard

Copied optional public extra-attribute words in row-major order.

Link copied to clipboard

Copied public render cell flags in row-major order.

Link copied to clipboard

Last copied frame generation.

Link copied to clipboard

Whether any copied visible row contains SGR blinking text.

Link copied to clipboard

Retained history lines reported by the most recent frame.

Link copied to clipboard

Copied optional hyperlink identifiers in row-major order. Zero means no hyperlink.

Link copied to clipboard

Cached per-row render generations.

Link copied to clipboard

Cached per-row marker for visible cells carrying the SGR blink attribute.

Link copied to clipboard

Cached per-row stable logical line identities.

Link copied to clipboard

Cached per-row soft-wrap flags.

Link copied to clipboard

Last copied color palette.

Link copied to clipboard
var rows: Int

Cached visible height in rows.

Link copied to clipboard

Resolved scrollback offset copied by the most recent frame.

Link copied to clipboard

Whether the most recent updateFrom call changed the logical frame shape.

Link copied to clipboard

Last copied structure generation.

Functions

Link copied to clipboard
open override fun accept(frame: TerminalRenderFrame)

Copies row data, cursor state, active buffer kind, and color palette from the given frame into this cache's primitive storage.

Link copied to clipboard

Returns the codepoint length encoded in ref.

Link copied to clipboard

Returns the codepoint offset encoded in ref.

Link copied to clipboard
fun clusterText(row: Int, column: Int): String?

Returns cluster text for diagnostics or compatibility callers.

Link copied to clipboard
fun rowOffset(row: Int): Int

Returns the row-major base offset for row in flattened cell planes.

Link copied to clipboard

Copies changed rows and cursor state from reader.

fun updateFrom(reader: TerminalRenderFrameReader, scrollbackOffset: Int)

Copies changed rows and cursor state for a caller-owned scrollback viewport.

fun updateFrom(reader: TerminalRenderFrameReader, scrollbackOffset: Int, viewportRows: Int)

Copies changed rows and cursor state for a caller-owned scrollback viewport with optional render-only overscan rows.