Raxol.Terminal.Buffer.SafeManager (Raxol v2.0.1)

View Source

Safe buffer manager that handles buffer operations with error recovery.

This module provides a safe interface to buffer operations, ensuring that failures don't crash the system and providing fallback behavior.

Summary

Functions

Safely clears the buffer.

Safely gets a cell from the buffer.

Gets buffer info safely.

Safely reads from the buffer.

Safely resizes the buffer.

Safely scrolls the buffer.

Safely sets a cell in the buffer.

Starts a safe manager process.

Safely writes data to the buffer.

Functions

clear(manager)

@spec clear(pid() | atom()) :: :ok | {:error, term()}

Safely clears the buffer.

get_cell(manager, x, y)

@spec get_cell(pid() | atom(), non_neg_integer(), non_neg_integer()) ::
  {:ok, map()} | {:error, term()}

Safely gets a cell from the buffer.

info(manager)

@spec info(pid() | atom()) :: {:ok, map()} | {:error, term()}

Gets buffer info safely.

read(manager, count)

@spec read(pid() | atom(), non_neg_integer()) :: {:ok, binary()} | {:error, term()}

Safely reads from the buffer.

resize(manager, width, height)

@spec resize(pid() | atom(), non_neg_integer(), non_neg_integer()) ::
  :ok | {:error, term()}

Safely resizes the buffer.

scroll(manager, lines)

@spec scroll(pid() | atom(), integer()) :: :ok | {:error, term()}

Safely scrolls the buffer.

set_cell(manager, x, y, cell)

@spec set_cell(pid() | atom(), non_neg_integer(), non_neg_integer(), map()) ::
  :ok | {:error, term()}

Safely sets a cell in the buffer.

start_link()

@spec start_link() :: {:ok, pid()} | {:error, term()}

Starts a safe manager process.

write(manager, data)

@spec write(pid() | atom(), binary()) :: :ok | {:error, term()}

Safely writes data to the buffer.