Raxol.Terminal.IO.UnifiedIO (Raxol v0.5.0)

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

Functions

Returns a specification to start this module under a supervisor.

Cleans up the I/O manager.

Initializes the terminal IO system.

Processes an input event.

Processes output data.

Resets the configuration to defaults.

Resizes the terminal.

Sets a specific configuration value.

Sets cursor visibility.

Starts the unified IO system.

Updates the IO configuration.

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.UnifiedIO{
  buffer: String.t(),
  buffer_manager: Raxol.Terminal.Buffer.UnifiedManager.t(),
  clipboard_content: String.t() | nil,
  clipboard_history: [String.t()],
  command_history: Raxol.Terminal.Commands.History.t(),
  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,
  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.UnifiedRenderer.t(),
  scroll_buffer: Raxol.Terminal.Scroll.UnifiedScroll.t()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

cleanup(io)

Cleans up the I/O manager.

init_terminal(width, height, config)

Initializes the terminal IO system.

process_input(event)

Processes an input event.

process_output(data)

Processes output data.

reset_config()

Resets the configuration to defaults.

resize(width, height)

Resizes the terminal.

set_config_value(path, value)

Sets a specific configuration value.

set_cursor_visibility(visible)

Sets cursor visibility.

start_link(opts \\ %{})

Starts the unified IO system.

update_config(config)

Updates the IO configuration.