Raxol.Terminal.Input.InputHandler (Raxol v2.0.1)

View Source

Handles input processing for the terminal emulator.

This module manages keyboard input, mouse events, input history, and modifier key states.

Summary

Functions

Adds current buffer to history if not empty.

Checks if buffer is empty.

Clears the input buffer.

Gets buffer contents.

Gets history entry at specified index.

Gets current input mode.

Handles printable character input for the terminal emulator.

Creates a new input handler with default values.

Moves to next (newer) history entry.

Moves to previous (older) history entry.

Processes key with current modifier state.

Processes regular keyboard input.

Processes mouse events.

Processes special keys like arrow keys, function keys, etc.

Sets input mode.

Sets mouse enabled state.

Updates modifier key state.

Types

t()

@type t() :: %Raxol.Terminal.Input.InputHandler{
  buffer: term(),
  history_index: term(),
  input_history: term(),
  mode: term(),
  modifier_state: term(),
  mouse_buttons: term(),
  mouse_enabled: term(),
  mouse_position: term()
}

Functions

add_to_history(handler)

@spec add_to_history(t()) :: t()

Adds current buffer to history if not empty.

buffer_empty?(handler)

@spec buffer_empty?(t()) :: boolean()

Checks if buffer is empty.

clear_buffer(handler)

@spec clear_buffer(t()) :: t()

Clears the input buffer.

get_buffer_contents(handler)

@spec get_buffer_contents(t()) :: String.t()

Gets buffer contents.

get_history_entry(handler, index)

@spec get_history_entry(t(), integer()) :: t()

Gets history entry at specified index.

get_mode(handler)

@spec get_mode(t()) :: atom()

Gets current input mode.

handle_printable_character(emulator, char_codepoint, params, single_shift)

@spec handle_printable_character(any(), integer(), map(), atom() | nil) ::
  {any(), any()}

Handles printable character input for the terminal emulator.

new()

@spec new() :: t()

Creates a new input handler with default values.

next_history_entry(handler)

@spec next_history_entry(t()) :: {t(), String.t()}

Moves to next (newer) history entry.

previous_history_entry(handler)

@spec previous_history_entry(t()) :: {t(), String.t()}

Moves to previous (older) history entry.

process_key_with_modifiers(handler, key)

@spec process_key_with_modifiers(t(), String.t()) :: t()

Processes key with current modifier state.

process_keyboard(handler, key)

@spec process_keyboard(t(), String.t()) :: t()

Processes regular keyboard input.

process_mouse(handler, arg)

@spec process_mouse(t(), tuple()) :: t()

Processes mouse events.

process_special_key(handler, key)

@spec process_special_key(t(), atom()) :: t()

Processes special keys like arrow keys, function keys, etc.

set_mode(handler, mode)

@spec set_mode(t(), atom()) :: t()

Sets input mode.

set_mouse_enabled(handler, enabled)

@spec set_mouse_enabled(t(), boolean()) :: t()

Sets mouse enabled state.

update_modifier(handler, modifier, state)

@spec update_modifier(t(), String.t(), boolean()) :: t()

Updates modifier key state.