ETee.Cell (e_tee v0.1.0)

Copy Markdown View Source

One character cell.

char holds a whole grapheme cluster, not a codepoint, so combining marks stay attached to the character they modify. width is the display width from ETee.CharacterWidth.

A double-width grapheme occupies two cells: the grapheme itself with width: 2, followed by spacer/0, which carries no text and has width: 0. Consumers rendering a row skip spacers rather than emitting them.

Summary

Functions

An empty cell carrying the default style.

An empty cell carrying a specific style, as erasing with a background colour produces.

True when the cell holds no visible text.

A cell holding a grapheme, with its display width measured.

The zero-width placeholder that follows a double-width grapheme.

The zero-width placeholder carrying a specific style.

True when the cell is the placeholder half of a double-width grapheme.

Types

t()

@type t() :: %ETee.Cell{char: String.t(), style: ETee.Style.t(), width: 0..2}

Functions

blank()

@spec blank() :: t()

An empty cell carrying the default style.

blank(style)

@spec blank(ETee.Style.t()) :: t()

An empty cell carrying a specific style, as erasing with a background colour produces.

blank?(cell)

@spec blank?(t()) :: boolean()

True when the cell holds no visible text.

new(char, style \\ %Style{})

@spec new(String.t(), ETee.Style.t()) :: t()

A cell holding a grapheme, with its display width measured.

spacer()

@spec spacer() :: t()

The zero-width placeholder that follows a double-width grapheme.

spacer(style)

@spec spacer(ETee.Style.t()) :: t()

The zero-width placeholder carrying a specific style.

spacer?(cell)

@spec spacer?(t()) :: boolean()

True when the cell is the placeholder half of a double-width grapheme.