struct

TermBuf::Unicode::Grapheme

Inherits Struct < Value < Object

One extended grapheme cluster, located by byte offset within its source string so that scanning a string allocates nothing.

Constructors

new(start : Int32, bytesize : Int32, width : Int32, char : Char | Nil)
Source

Instance methods

bytesize

Length of the cluster in bytes.

Source
char

The cluster's only character, when it consists of a single code point. nil for multi-code-point clusters, which the buffer keeps in its cluster pool rather than inline in a cell.

Source
start

Byte offset of the cluster within the string it was scanned from.

Source
text(source : String) : String

Extracts the cluster from the string it was scanned from.

Source
width

Terminal cells the cluster occupies, from zero up to Cell::MAX_WIDTH.

Source