KetraTerm
API · DevelopmentAll versions

create

fun create(width: Int, height: Int, maxHistory: Int = 1000): TerminalRenderBuffer

Creates a terminal buffer with the requested visible dimensions and scrollback capacity.

The returned TerminalRenderBuffer exposes both core state and render frames. Direct embedders may copy frames while externally serializing grid reads, borrowed views, and mutations as documented by TerminalBuffer. Atomic mode snapshots retain their narrower method-level concurrency guarantees; the factory does not install a synchronization boundary.

Return

A new TerminalBuffer instance initialized with the given dimensions.

Parameters

width

Visible width in cells. Must be at least MIN_WIDTH.

height

Visible height in rows. Must be > 0.

maxHistory

Maximum history lines; non-negative and small enough that adding height does not exceed Int.MAX_VALUE. Zero disables retained scrollback.

Throws

if width is below MIN_WIDTH, height is non-positive, maxHistory is negative, or the retained line capacity would overflow Int.