Raxol.Terminal.Emulator.Input (Raxol Terminal v2.6.0)

Copy Markdown View Source

Handles input processing for the terminal emulator. Provides functions for key event handling, command history, and input parsing.

Summary

Functions

Updates the command history with a new command. Returns {:ok, updated_emulator}.

Clears the command buffer. Returns {:ok, updated_emulator}.

Clears the command history. Returns {:ok, updated_emulator}.

Gets the current command buffer. Returns the current command buffer.

Gets the command history. Returns the list of commands in history.

Creates a new input handler.

Processes a key event through the emulator. Returns {:ok, updated_emulator, commands} or {:error, reason}.

Processes a key press event. Returns {:ok, updated_emulator, commands} or {:error, reason}.

Processes a key release event. Returns {:ok, updated_emulator, commands} or {:error, reason}.

Processes a mouse event. Returns {:ok, updated_emulator, commands} or {:error, reason}.

Sets the command buffer. Returns {:ok, updated_emulator}.

Functions

add_to_history(emulator, command)

Updates the command history with a new command. Returns {:ok, updated_emulator}.

clear_command_buffer(emulator)

@spec clear_command_buffer(Raxol.Terminal.Emulator.Struct.t()) ::
  {:ok, Raxol.Terminal.Emulator.Struct.t()}

Clears the command buffer. Returns {:ok, updated_emulator}.

clear_history(emulator)

Clears the command history. Returns {:ok, updated_emulator}.

get_command_buffer(emulator)

@spec get_command_buffer(Raxol.Terminal.Emulator.Struct.t()) :: String.t()

Gets the current command buffer. Returns the current command buffer.

get_history(emulator)

@spec get_history(Raxol.Terminal.Emulator.Struct.t()) :: list()

Gets the command history. Returns the list of commands in history.

new()

Creates a new input handler.

process_key_event(emulator, event)

Processes a key event through the emulator. Returns {:ok, updated_emulator, commands} or {:error, reason}.

process_key_press(emulator, key, modifiers)

Processes a key press event. Returns {:ok, updated_emulator, commands} or {:error, reason}.

process_key_release(emulator, key, modifiers)

Processes a key release event. Returns {:ok, updated_emulator, commands} or {:error, reason}.

process_mouse_event(emulator, event)

@spec process_mouse_event(map(), map()) :: {:ok, map(), list()} | {:error, String.t()}

Processes a mouse event. Returns {:ok, updated_emulator, commands} or {:error, reason}.

set_command_buffer(emulator, buffer)

Sets the command buffer. Returns {:ok, updated_emulator}.