Raxol.Terminal.Emulator.Input (Raxol v0.4.0)
View SourceHandles 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.
Processes a key event. Returns {:ok, updated_emulator, commands} or {:error, reason}.
Processes a key press 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
@spec add_to_history(Raxol.Terminal.Emulator.t(), String.t()) :: {:ok, Raxol.Terminal.Emulator.t()}
Updates the command history with a new command. Returns {:ok, updated_emulator}.
@spec clear_command_buffer(Raxol.Terminal.Emulator.t()) :: {:ok, Raxol.Terminal.Emulator.t()}
Clears the command buffer. Returns {:ok, updated_emulator}.
@spec clear_history(Raxol.Terminal.Emulator.t()) :: {:ok, Raxol.Terminal.Emulator.t()}
Clears the command history. Returns {:ok, updated_emulator}.
@spec get_command_buffer(Raxol.Terminal.Emulator.t()) :: String.t()
Gets the current command buffer. Returns the current command buffer.
@spec get_history(Raxol.Terminal.Emulator.t()) :: list()
Gets the command history. Returns the list of commands in history.
@spec process_key_event(Raxol.Terminal.Emulator.t(), map()) :: {:ok, Raxol.Terminal.Emulator.t(), list()} | {:error, String.t()}
Processes a key event. Returns {:ok, updated_emulator, commands} or {:error, reason}.
@spec process_key_press(Raxol.Terminal.Emulator.t(), map()) :: {:ok, Raxol.Terminal.Emulator.t(), list()} | {:error, String.t()}
Processes a key press event. Returns {:ok, updated_emulator, commands} or {:error, reason}.
@spec process_mouse_event(Raxol.Terminal.Emulator.t(), map()) :: {:ok, Raxol.Terminal.Emulator.t(), list()} | {:error, String.t()}
Processes a mouse event. Returns {:ok, updated_emulator, commands} or {:error, reason}.
@spec set_command_buffer(Raxol.Terminal.Emulator.t(), String.t()) :: {:ok, Raxol.Terminal.Emulator.t()}
Sets the command buffer. Returns {:ok, updated_emulator}.