TerminalRenderPublisher

class TerminalRenderPublisher(columns: Int, rows: Int)

Triple-buffered render cache publisher.

One buffer is writer-owned (back). One buffer is UI-readable (front). One buffer is spare (recycled after front is replaced).

Writer and UI never touch the same buffer simultaneously when UI consumers access the front buffer through readCurrent.

Parameters

columns

initial cache width in cells.

rows

initial cache height in rows.

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard

Returns the latest published snapshot without acquiring a reader lease.

Link copied to clipboard
inline fun <T> readCurrent(block: (TerminalRenderCache) -> T): T?

Reads the latest published front buffer while preventing it from being recycled as a writer-owned back buffer.

Link copied to clipboard

Called from render worker thread only. Reads from reader, updates back buffer, publishes as new front.

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

Called from render worker thread only.