KetraTerm
API · DevelopmentAll versions

writeCluster

abstract fun writeCluster(codepoints: IntArray, length: Int = codepoints.size)

Writes one pre-segmented grapheme cluster to the grid.

This is the parser-facing ingress for complex printable sequences such as combining-mark clusters, ZWJ emoji, and variation-selector sequences. The core computes the final display width from its active width policy, including East Asian ambiguous-width mode. The used prefix is copied into core-owned storage before returning; the caller may immediately reuse the array. At most 32 codepoints are accepted, as defined by io.github.ketraterm.protocol.TerminalTextLimits.MAX_CLUSTER_CODEPOINTS.

Parameters

codepoints

Codepoints that make up the grapheme cluster.

length

Number of valid codepoints in codepoints.

Throws

if length exceeds 32 or is outside 1..codepoints.size or any value in the used prefix is not a Unicode scalar. The entire prefix is checked before mutation; unused array entries are ignored.