Raxol.Terminal.ANSI.Processor (Raxol v0.4.0)

View Source

ANSI sequence processor module.

This module processes ANSI escape sequences for terminal control, including:

  • Cursor movement
  • Text formatting
  • Screen manipulation
  • Terminal state changes
  • Bracketed paste mode
  • Focus reporting

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets the current buffer manager.

Callback implementation for GenServer.init/1.

Process a parsed ANSI sequence and return the updated emulator state. This is a direct interface for processing sequences without using the GenServer.

Processes an ANSI sequence.

Sets the buffer manager for the processor.

Types

sequence()

@type sequence() :: %{
  type: sequence_type(),
  command: String.t(),
  params: [String.t()],
  intermediate: String.t(),
  final: String.t(),
  text: String.t()
}

sequence_type()

@type sequence_type() :: :csi | :osc | :sos | :pm | :apc | :esc | :text

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_buffer_manager(processor)

Gets the current buffer manager.

Examples

iex> {:ok, processor} = Processor.start_link([])
iex> {:ok, buffer_manager} = Manager.new(80, 24)
iex> :ok = Processor.set_buffer_manager(processor, buffer_manager)
iex> Processor.get_buffer_manager(processor)
{:ok, ^buffer_manager}

init(opts)

Callback implementation for GenServer.init/1.

process(sequence, emulator)

Process a parsed ANSI sequence and return the updated emulator state. This is a direct interface for processing sequences without using the GenServer.

Parameters

  • sequence - The parsed ANSI sequence (result from Parser.parse_sequence/1)
  • emulator - The current emulator state

Returns

Updated emulator state

Examples

iex> sequence = Raxol.Terminal.ANSI.Parser.parse_sequence("")
iex> new_state = Raxol.Terminal.ANSI.Processor.process(sequence, emulator)

process_sequence(processor, sequence)

Processes an ANSI sequence.

Examples

iex> {:ok, processor} = Processor.start_link([])
iex> {:ok, buffer_manager} = Manager.new(80, 24)
iex> :ok = Processor.set_buffer_manager(processor, buffer_manager)
iex> {:ok, _} = Processor.process_sequence(processor, "")
:ok

set_buffer_manager(processor, buffer_manager)

Sets the buffer manager for the processor.

Examples

iex> {:ok, processor} = Processor.start_link([])
iex> {:ok, buffer_manager} = Manager.new(80, 24)
iex> :ok = Processor.set_buffer_manager(processor, buffer_manager)
:ok

start_link(opts \\ [])