Raxol.Terminal.InputHandler (Raxol v0.4.0)

View Source

Handles parsed terminal input events (printable characters, control codes, escape sequences) and updates the Emulator state accordingly.

Summary

Functions

Handle a control sequence in the input.

Handles clipboard copy operation. (Currently copies the entire buffer)

Handles clipboard cut operation. (Currently cuts the entire buffer)

Handles clipboard paste operation.

Handles a printable character, using single_shift if set (for SS2/SS3).

Inserts text at the specified position in the buffer.

Creates a new input handler with default values.

Processes a single character codepoint. Delegates to C0 handlers or printable character handlers.

Process a complete input string, handling both normal characters and control sequences.

Process a character or string input, handling character sets and translations.

Processes a single printable character codepoint. Handles writing the character to the buffer, cursor advancement, and line wrapping.

Processes a raw input string for the terminal, parsing control sequences and printable characters. This function drives the terminal command parser.

Types

t()

@type t() :: %Raxol.Terminal.InputHandler{
  buffer: String.t(),
  cursor_position: non_neg_integer(),
  mode_manager: Raxol.Terminal.ModeManager.t(),
  tab_completion: map(),
  tab_completion_index: non_neg_integer(),
  tab_completion_matches: [String.t()]
}

Functions

handle_control_sequence(sequence, char_sets)

Handle a control sequence in the input.

handle_copy(handler)

@spec handle_copy(t()) :: {:ok, t()} | {:error, any()}

Handles clipboard copy operation. (Currently copies the entire buffer)

handle_cut(handler)

@spec handle_cut(t()) :: {:ok, t()} | {:error, any()}

Handles clipboard cut operation. (Currently cuts the entire buffer)

handle_paste(handler)

@spec handle_paste(t()) :: {:ok, t()} | {:error, any()}

Handles clipboard paste operation.

handle_printable_character(emulator, char_codepoint, params, single_shift)

@spec handle_printable_character(
  Raxol.Terminal.Emulator.t(),
  integer(),
  any(),
  nil | :ss2 | :ss3
) ::
  {Raxol.Terminal.Emulator.t(), list()}

Handles a printable character, using single_shift if set (for SS2/SS3).

insert_text(buffer, position, text)

@spec insert_text(String.t(), non_neg_integer(), String.t()) :: String.t()

Inserts text at the specified position in the buffer.

new()

@spec new() :: t()

Creates a new input handler with default values.

process_character(emulator, char_codepoint)

@spec process_character(Raxol.Terminal.Emulator.t(), integer()) ::
  Raxol.Terminal.Emulator.t()

Processes a single character codepoint. Delegates to C0 handlers or printable character handlers.

process_complete_input(input, char_sets)

Process a complete input string, handling both normal characters and control sequences.

process_input(input, char_sets)

Process a character or string input, handling character sets and translations.

process_printable_character(emulator, char_codepoint)

@spec process_printable_character(Raxol.Terminal.Emulator.t(), integer()) ::
  Raxol.Terminal.Emulator.t()

Processes a single printable character codepoint. Handles writing the character to the buffer, cursor advancement, and line wrapping.

process_terminal_input(emulator, input)

@spec process_terminal_input(Raxol.Terminal.Emulator.t(), String.t()) ::
  {Raxol.Terminal.Emulator.t(), String.t()}

Processes a raw input string for the terminal, parsing control sequences and printable characters. This function drives the terminal command parser.