Raxol.Terminal.Emulator.SafeEmulator (Raxol v2.0.1)

View Source

Enhanced terminal emulator with comprehensive error handling. Refactored to use functional error handling patterns instead of try/catch.

Summary

Functions

Performs checkpoint/restore operations.

Returns a specification to start this module under a supervisor.

Gets error statistics and health status.

Gets the current terminal state with error recovery.

Safely handles ANSI sequences with fallback.

Safely processes input with validation and error recovery.

Triggers recovery mechanism manually.

Safely resizes the terminal with validation.

Types

error_stats()

@type error_stats() :: %{
  total_errors: non_neg_integer(),
  errors_by_type: map(),
  last_error: {DateTime.t(), term()} | nil,
  recovery_attempts: non_neg_integer()
}

t()

@type t() :: %Raxol.Terminal.Emulator.SafeEmulator{
  config: map(),
  emulator_state: term(),
  error_stats: error_stats(),
  input_buffer: binary(),
  last_checkpoint: term(),
  recovery_state: atom()
}

Functions

checkpoint(pid \\ __MODULE__)

Performs checkpoint/restore operations.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_health(pid \\ __MODULE__)

Gets error statistics and health status.

get_state(pid \\ __MODULE__)

Gets the current terminal state with error recovery.

handle_manager_cast(msg, state)

Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.

handle_sequence(pid \\ __MODULE__, sequence)

Safely handles ANSI sequences with fallback.

process_input(pid \\ __MODULE__, input)

Safely processes input with validation and error recovery.

recover(pid \\ __MODULE__)

Triggers recovery mechanism manually.

resize(pid \\ __MODULE__, width, height)

Safely resizes the terminal with validation.

restore(pid \\ __MODULE__, checkpoint)

start_link(init_opts \\ [])