Cell-based terminal buffer. Each cell stores a character, fg/bg colors, and attributes.
Maps to ElixirOpentui's OptimizedBuffer. This is the "framebuffer" — layout and painting write cells into this buffer, and the renderer diffs it against the previous frame to produce minimal ANSI output.
Summary
Functions
Clear the buffer to blank cells.
Diff two buffers, returning list of {x, y, new_cell} changes.
Write a character at (x, y) with fg/bg colors and optional text attributes.
Write a string horizontally starting at (x, y) with optional text attributes.
Fill a rectangular region with a character, colors, and optional text attributes.
Get the cell at (x, y). Returns nil if out of bounds.
Get the hit_id at coordinates (x, y).
Create a new buffer with the given dimensions.
Pop the top scissor rect, restoring the previous clip region.
Push a scissor rect. Drawing is clipped to the intersection of all active scissor rects.
Set a cell at (x, y). No-op if out of bounds or outside scissor rect.
Resize the buffer. Contents are lost.
Set hit_id for a rectangular region (for mouse event targeting).
Convert the full buffer to a list of row strings (for testing/display).
Types
@type t() :: %ElixirOpentui.Buffer{ cells: :array.array(cell()), cols: non_neg_integer(), default_bg: ElixirOpentui.Color.t(), default_fg: ElixirOpentui.Color.t(), rows: non_neg_integer(), scissor_stack: [{integer(), integer(), non_neg_integer(), non_neg_integer()}] }
Functions
Clear the buffer to blank cells.
@spec diff(t(), t()) :: [{non_neg_integer(), non_neg_integer(), cell()}]
Diff two buffers, returning list of {x, y, new_cell} changes.
@spec draw_char( t(), integer(), integer(), String.t(), ElixirOpentui.Color.t(), ElixirOpentui.Color.t(), keyword() ) :: t()
Write a character at (x, y) with fg/bg colors and optional text attributes.
@spec draw_text( t(), integer(), integer(), String.t(), ElixirOpentui.Color.t(), ElixirOpentui.Color.t(), keyword() ) :: t()
Write a string horizontally starting at (x, y) with optional text attributes.
@spec fill_rect( t(), integer(), integer(), non_neg_integer(), non_neg_integer(), String.t(), ElixirOpentui.Color.t(), ElixirOpentui.Color.t(), keyword() ) :: t()
Fill a rectangular region with a character, colors, and optional text attributes.
Get the cell at (x, y). Returns nil if out of bounds.
Get the hit_id at coordinates (x, y).
@spec new(non_neg_integer(), non_neg_integer(), keyword()) :: t()
Create a new buffer with the given dimensions.
Pop the top scissor rect, restoring the previous clip region.
Push a scissor rect. Drawing is clipped to the intersection of all active scissor rects.
Set a cell at (x, y). No-op if out of bounds or outside scissor rect.
@spec resize(t(), non_neg_integer(), non_neg_integer()) :: t()
Resize the buffer. Contents are lost.
@spec set_hit_region( t(), integer(), integer(), non_neg_integer(), non_neg_integer(), term() ) :: t()
Set hit_id for a rectangular region (for mouse event targeting).
Convert the full buffer to a list of row strings (for testing/display).