Vibe.TUI.TerminalPainter (vibe v0.2.1)

Copy Markdown View Source

Pure terminal-diff state machine for Vibe's TUI runtime.

Receives fully rendered semantic lines and a cursor position in document coordinates. Returns iodata to write to the terminal plus updated state.

Three render paths:

  • First paint — writes all lines, creating native terminal scrollback.
  • Viewport shift — scrolls via \r\n then repaints the visible area.
  • In-place patch — rewrites only changed lines within the current viewport.

Summary

Types

t()

@type t() :: %Vibe.TUI.TerminalPainter{
  cursor: {pos_integer(), pos_integer()},
  hardware_row: pos_integer(),
  height: pos_integer(),
  lines: [IO.chardata()],
  viewport_top: pos_integer(),
  width: pos_integer()
}

Functions

cleanup()

@spec cleanup() :: IO.chardata()

force_full_redraw(painter)

@spec force_full_redraw(t()) :: t()

new(width, height)

@spec new(pos_integer(), pos_integer()) :: t()

render(painter, lines, cursor)

@spec render(t(), [IO.chardata()], {pos_integer(), pos_integer()}) ::
  {IO.chardata(), t()}

resize(painter, width, height)

@spec resize(t(), pos_integer(), pos_integer()) :: t()