class TermBuf::ClusterPool

Overview

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.

Defined in:

termbuf/core/style_table.cr

Constant Summary

NONE = 0_u32

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

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def [](id : UInt32) : String #

The cluster id refers to.


[View source]
def []?(id : UInt32) : String | Nil #

The cluster id refers to, or nil for NONE.


[View source]
def id(text : String) : UInt32 #

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


[View source]
def size : Int32 #

How many clusters have been interned.


[View source]