Raxol.Terminal.IO.IOServer (Raxol v2.0.1)

View Source

Unified input/output system for the terminal emulator.

This module provides a consolidated interface for handling all terminal I/O operations, including:

  • Input event processing (keyboard, mouse, special keys)
  • Output buffering and processing
  • Command history management
  • Input mode management
  • Event propagation control
  • Performance optimizations

Summary

Types

completion_callback()

@type completion_callback() :: (String.t() -> [String.t()])

input_mode()

@type input_mode() :: :normal | :insert | :replace | :command

mouse_button()

@type mouse_button() :: 0 | 1 | 2 | 3 | 4

mouse_event()

@type mouse_event() ::
  {mouse_event_type(), mouse_button(), non_neg_integer(), non_neg_integer()}

mouse_event_type()

@type mouse_event_type() :: :press | :release | :move | :scroll

special_key()

@type special_key() ::
  :up
  | :down
  | :left
  | :right
  | :home
  | :end
  | :page_up
  | :page_down
  | :insert
  | :delete
  | :escape
  | :tab
  | :enter
  | :backspace
  | :f1
  | :f2
  | :f3
  | :f4
  | :f5
  | :f6
  | :f7
  | :f8
  | :f9
  | :f10
  | :f11
  | :f12

t()

@type t() :: %Raxol.Terminal.IO.IOServer{
  buffer: String.t(),
  buffer_manager: UnifiedManager.t(),
  clipboard_content: String.t() | nil,
  clipboard_history: [String.t()],
  command_history: term(),
  completion_callback: completion_callback() | nil,
  completion_context: map() | nil,
  completion_index: non_neg_integer(),
  completion_options: [String.t()],
  config: map(),
  history_index: integer() | nil,
  input_history: [String.t()],
  input_queue: [String.t()],
  last_event_time: integer() | nil,
  last_input: String.t() | nil,
  mode: input_mode(),
  modifier_state: map(),
  mouse_buttons: MapSet.t(mouse_button()),
  mouse_enabled: boolean(),
  mouse_position: {non_neg_integer(), non_neg_integer()},
  output_buffer: String.t(),
  output_processing: boolean(),
  output_queue: [String.t()],
  processing_escape: boolean(),
  prompt: String.t() | nil,
  renderer: Raxol.Terminal.Render.RenderServer.t(),
  scroll_buffer: Raxol.Terminal.Buffer.Scroll.t()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup(io, process \\ __MODULE__)

Cleans up the I/O manager.

handle_manager_cast(msg, state)

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

handle_manager_info(msg, state)

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

init_terminal(width, height, config, process \\ __MODULE__)

Initializes the terminal IO system.

process_input(event, process \\ __MODULE__)

Processes an input event.

process_output(data, process \\ __MODULE__)

Processes output data.

reset_config(process \\ __MODULE__)

Resets the configuration to defaults.

resize(width, height, process \\ __MODULE__)

Resizes the terminal.

set_config_value(path, value, process \\ __MODULE__)

Sets a specific configuration value.

set_cursor_visibility(visible, process \\ __MODULE__)

Sets cursor visibility.

start_link(init_opts \\ [])

update_config(config, process \\ __MODULE__)

Updates the IO configuration.