struct
TermBuf::Cell
- TermBuf::Cell
- Struct
- Value
- Object
Overview
One cell of the terminal grid.
Sixteen bytes, fixed size, with no reference to anything on the heap, so a
Grid is one flat Slice(Cell) and a row is a Slice view into it.
A wide character occupies two cells: the first carries the character with
#width two, and the second is a continuation with #width zero. Neither
half is ever written without the other; Grid enforces that.
Defined in:
termbuf/core/cell.crConstructors
-
.blank(style : StyleId = StyleTable::DEFAULT) : Cell
An empty cell carrying style, which is what a cleared or scrolled-away part of the screen holds.
-
.continuation(style : StyleId = StyleTable::DEFAULT) : Cell
The second half of a wide character.
- .new(char : Char, style : StyleId = StyleTable::DEFAULT, width : UInt8 = 1_u8, cluster : UInt32 = ClusterPool::NONE)
Instance Method Summary
-
#blank? : Bool
Whether the cell holds a space and nothing else, ignoring its style.
-
#char : Char
The cell's character, or
'\0'when this cell continues a wide one. -
#cluster : UInt32
ClusterPoolid for a multi code point grapheme cluster, orClusterPool::NONEwhen#charsays everything. -
#continuation? : Bool
Whether this is the right half of a wide character.
-
#style : StyleId
Id into the buffer's
StyleTable. -
#text(pool : ClusterPool) : String
The text this cell paints, resolving a cluster id through pool.
-
#to_s(io : IO) : Nil
Same as
#inspect(io). -
#wide? : Bool
Whether this is the left half of a wide character.
-
#width : UInt8
Cells this character occupies: zero for a continuation, one for a narrow character, two for a wide one.
Constructor Detail
An empty cell carrying style, which is what a cleared or scrolled-away part of the screen holds.
The second half of a wide character.
Instance Method Detail
The cell's character, or '\0' when this cell continues a wide one.
When #cluster is set, this is the cluster's first code point and the
full text lives in the pool.
ClusterPool id for a multi code point grapheme cluster, or
ClusterPool::NONE when #char says everything.
The text this cell paints, resolving a cluster id through pool. Falls back to the base character if pool does not know the cluster, so that rendering a grid against the wrong pool degrades rather than raising.
Cells this character occupies: zero for a continuation, one for a narrow character, two for a wide one.