KetraTerm
API · DevelopmentAll versions

updatePreviousCluster

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

Updates the most recently written printable cell with a complete grapheme sequence.

The caller owns segmentation and supplies the entire retained sequence, including the previously published prefix. Core preserves the target's attributes, recalculates width, and adjusts its occupied span and following cursor. This does not insert a new cell or advance past a second grapheme. In-row width changes recompute the following cursor and pending wrap; completed wraps, scrolls, overwrites and insert shifts are not reversed. Narrowing blanks the released spacer; widening overwrites the next cell only if it fits inside the right margin, otherwise the cluster stays in one cell. Updates never shift cells, including in insert mode. A write rejected by geometry or disabled autowrap clears the target; invalid input leaves it unchanged. If no remembered printable target remains, valid input is ignored. This operation does not validate grapheme boundaries or compare the supplied prefix with stored text.

The used prefix is copied into core-owned storage before returning; the caller may immediately reuse the array. The same 32-codepoint bound applies to direct callers.

Parameters

codepoints

Complete retained codepoints of the same grapheme.

length

Number of valid codepoints in codepoints.

Throws

if length exceeds 32 or is outside 1..codepoints.size or any used entry is not a Unicode scalar, even without a target. Validation precedes mutation.