Buffer

class Buffer(val width: Int, val height: Int)(source)

Represents a grid of characters and their associated styles.

The buffer uses primitive arrays to store data internally for efficient management of terminal cell data.

Constructors

Link copied to clipboard
constructor(width: Int, height: Int)

Properties

Link copied to clipboard
val height: Int

The vertical dimension of the buffer in characters.

Link copied to clipboard
val width: Int

The horizontal dimension of the buffer in characters.

Functions

Link copied to clipboard
fun clear()

Resets the entire buffer to default characters and styles.

Link copied to clipboard
fun get(x: Int, y: Int): Cell

Retrieves the contents of a specific cell as a Cell object.

Link copied to clipboard
fun setBackground(x: Int, y: Int, color: Color)

Sets the background color of a specific cell.

Link copied to clipboard
fun setChar(x: Int, y: Int, char: Char? = null, foreground: Color? = null, background: Color? = null, bold: Boolean? = null, italic: Boolean? = null, underline: Boolean? = null, strikethrough: Boolean? = null)

Sets the character and styles for a specific cell.

Link copied to clipboard
fun writeString(x: Int, y: Int, text: String, foreground: Color? = null, background: Color? = null, bold: Boolean? = null, italic: Boolean? = null, underline: Boolean? = null, strikethrough: Boolean? = null)

Writes a string into the buffer at the specified coordinates.