Raxol.Terminal.ScreenBuffer.Core (Raxol v2.0.1)

View Source

Core functionality for screen buffer creation, initialization, and basic queries. Consolidates: Initializer, Common, Helpers, and basic state management.

Summary

Functions

Clears the entire buffer.

Gets a cell at the specified coordinates.

Gets the character at the specified coordinates.

Gets the buffer dimensions.

Gets the buffer height.

Gets a line of cells.

Gets the buffer width.

Creates a new screen buffer with the specified dimensions.

Resizes the buffer to new dimensions.

Converts buffer to legacy cell grid format for backward compatibility.

Checks if coordinates are within buffer bounds.

Types

t()

@type t() :: %Raxol.Terminal.ScreenBuffer.Core{
  alternate_screen: boolean(),
  cells: [[Raxol.Terminal.Cell.t()]],
  cursor_blink: boolean(),
  cursor_position: {non_neg_integer(), non_neg_integer()},
  cursor_style: atom(),
  cursor_visible: boolean(),
  damage_regions: [tuple()],
  default_style: map(),
  height: non_neg_integer(),
  scroll_position: non_neg_integer(),
  scroll_region: nil | {non_neg_integer(), non_neg_integer()},
  scrollback: [[Raxol.Terminal.Cell.t()]],
  scrollback_limit: non_neg_integer(),
  selection: nil | map(),
  width: non_neg_integer()
}

Functions

clear(buffer)

@spec clear(t()) :: t()

Clears the entire buffer.

get_cell(buffer, x, y)

@spec get_cell(t(), non_neg_integer(), non_neg_integer()) ::
  Raxol.Terminal.Cell.t() | nil

Gets a cell at the specified coordinates.

get_char(buffer, x, y)

@spec get_char(t(), non_neg_integer(), non_neg_integer()) :: String.t()

Gets the character at the specified coordinates.

get_dimensions(map)

@spec get_dimensions(t()) :: {non_neg_integer(), non_neg_integer()}

Gets the buffer dimensions.

get_height(map)

@spec get_height(t()) :: non_neg_integer()

Gets the buffer height.

get_line(buffer, y)

@spec get_line(t(), non_neg_integer()) :: [Raxol.Terminal.Cell.t()]

Gets a line of cells.

get_width(map)

@spec get_width(t()) :: non_neg_integer()

Gets the buffer width.

new(width, height, scrollback_limit \\ 1000)

Creates a new screen buffer with the specified dimensions.

resize(buffer, new_width, new_height)

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

Resizes the buffer to new dimensions.

to_cell_grid(buffer)

@spec to_cell_grid(t()) :: [[Raxol.Terminal.Cell.t()]]

Converts buffer to legacy cell grid format for backward compatibility.

within_bounds?(map, x, y)

@spec within_bounds?(t(), integer(), integer()) :: boolean()

Checks if coordinates are within buffer bounds.