Harlock.Render.Cell (harlock v0.2.0)

Copy Markdown View Source

A single terminal cell.

  • :char — a codepoint integer, a grapheme binary, nil (blank), or :continuation (the second cell of a wide grapheme).
  • :style_id — integer index into the frame's internal style table.

Single-codepoint graphemes (the common case — ASCII, Latin-1 NFC) take the integer fast path. Multi-codepoint graphemes (NFD diacritics, ZWJ sequences, regional-indicator flags) are stored as binaries so the grapheme is rendered verbatim. Wide graphemes occupy two cells: the grapheme at (row, col) and :continuation at (row, col + 1).

You'll see cells when inspecting a render via Harlock.Test.cells/1.

Summary

Types

char_value()

@type char_value() :: non_neg_integer() | String.t() | nil | :continuation

t()

@type t() :: %Harlock.Render.Cell{char: char_value(), style_id: non_neg_integer()}

Functions

blank(style_id \\ 0)

@spec blank(non_neg_integer()) :: t()

new(char, style_id)

@spec new(char_value(), non_neg_integer()) :: t()