ExRatatui.CellSession.Snapshot (ExRatatui v0.10.0)

Copy Markdown View Source

Full-buffer snapshot returned by ExRatatui.CellSession.take_cells/1.

Carries the dimensions of the buffer plus every cell, in row-major order — cells has length width * height. Use this when you need the complete picture: initial paint after a fresh client connects, one-off screenshot, regression test fixture.

For streaming updates use ExRatatui.CellSession.take_cells_diff/1 instead, which returns the same Cell shape inside an ExRatatui.CellSession.Diff payload but only includes cells that changed since the last diff call.

Fields

  • :width — terminal width in cells
  • :height — terminal height in cells
  • :cells — list of ExRatatui.CellSession.Cell.t/0 in row-major order: (0,0), (1,0), ..., (W-1,0), (0,1), ...

Examples

iex> %ExRatatui.CellSession.Snapshot{}
%ExRatatui.CellSession.Snapshot{width: 0, height: 0, cells: []}

Summary

Functions

Builds a t/0 from the raw %{width, height, cells} map the NIF returns. Each tuple in cells is converted via ExRatatui.CellSession.Cell.from_tuple/1.

Types

t()

@type t() :: %ExRatatui.CellSession.Snapshot{
  cells: [ExRatatui.CellSession.Cell.t()],
  height: non_neg_integer(),
  width: non_neg_integer()
}

Functions

from_native(map)

@spec from_native(%{
  width: non_neg_integer(),
  height: non_neg_integer(),
  cells: [tuple()]
}) :: t()

Builds a t/0 from the raw %{width, height, cells} map the NIF returns. Each tuple in cells is converted via ExRatatui.CellSession.Cell.from_tuple/1.