KetraTerm
API · DevelopmentAll versions

getClusterLength

open fun getClusterLength(col: Int): Int

Returns the number of codepoints in the cluster at col, or 0 for a scalar, blank, or wide spacer cell. This is the capacity required by readCluster, not a UTF-16 length or a display width.

Core-owned lines answer in constant time without allocating or copying. Grow a reusable destination only when this count exceeds its capacity. Keep the owning terminal serialized against mutation continuously from obtaining this borrowed line through sizing and copying; the count does not remain valid across mutation and the line must not escape that boundary.

Implementations with cluster storage must override this operation together with isCluster and readCluster. The default returns 0 when isCluster is false and rejects cluster cells rather than reporting an incorrect size.

Return

Exact cluster codepoint count, or 0 for a non-cluster cell. A core-owned void line returns 0 for any column.

Parameters

col

Column index (0-based), within this physical line's width.

Throws

for an invalid column in a core-owned physical line.

if a clustered implementation has not provided capacity discovery.