class

TermBuf::ClusterPool

Inherits Reference < Object

Stability: internal

Interns multi code point grapheme clusters so a Cell can carry a four byte id rather than a string reference. Id zero means the cell's own character says everything, which is the case for all but a handful of cells in practice.

Constants

NONE = 0_u32

The id meaning "no cluster; read the cell's character instead".

Constructors

Instance methods

[](id : UInt32) : String

The cluster id refers to.

Source
[]?(id : UInt32) : String | Nil

The cluster id refers to, or nil for NONE.

Source
code_point_columns(id : UInt32) : Int32

Columns a terminal that counts them per code point rather than per cluster would take for the cluster id refers to.

Worked out once, when the cluster was interned, because the paint path asks this of every composed cluster it writes and a terminal with Quirk::PerCodePointColumns misplaces the ones where this differs from the width the cell was given.

Source
id(text : String, policy : Unicode::WidthPolicy = Unicode.policy) : UInt32

The id for text, assigning one if this is the first time it is seen.

policy settles how many columns a terminal counting per code point would take for it, which is worked out here rather than at every paint; see #code_point_columns.

Source
size

How many clusters have been interned.

Source