Raxol.Terminal.InputHandler (Raxol v0.3.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.

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.

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)

@spec handle_control_sequence(
  String.t(),
  Raxol.Terminal.ANSI.CharacterSets.CharacterSets.t()
) ::
  {String.t(), Raxol.Terminal.ANSI.CharacterSets.CharacterSets.t()}

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.

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)

@spec process_complete_input(
  String.t(),
  Raxol.Terminal.ANSI.CharacterSets.CharacterSets.t()
) ::
  {String.t(), Raxol.Terminal.ANSI.CharacterSets.CharacterSets.t()}

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

process_input(input, char_sets)

@spec process_input(String.t(), Raxol.Terminal.ANSI.CharacterSets.CharacterSets.t()) ::
  {String.t(), Raxol.Terminal.ANSI.CharacterSets.CharacterSets.t()}

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.