struct TermBuf::Unicode::Grapheme

Overview

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

Defined in:

termbuf/unicode/grapheme.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(start : Int32, bytesize : Int32, width : Int32, char : Char | Nil) #

[View source]

Instance Method Detail

def bytesize : Int32 #

Length of the cluster in bytes.


[View source]
def char : Char | Nil #

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.


[View source]
def start : Int32 #

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


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

Extracts the cluster from the string it was scanned from.


[View source]
def width : Int32 #

Terminal cells the cluster occupies: zero, one, or two.


[View source]