Raxol.Terminal.EmulatorBehaviour behaviour (Raxol v2.0.1)
View SourceDefines the behaviour for the core Terminal Emulator.
This contract outlines the essential functions for managing terminal state, processing input, and handling resizing.
Summary
Callbacks
Gets the current cursor position (0-based).
Gets the current cursor visibility state.
Returns the currently active screen buffer.
Creates a new emulator with default dimensions and options.
Creates a new emulator with specified dimensions and default options.
Creates a new emulator with specified dimensions and options.
Creates a new emulator with specified dimensions, session ID, and client options.
Processes input data (e.g., user typing, escape sequences).
Resizes the emulator's screen buffers.
Updates the currently active screen buffer in the emulator state.
Types
@type t() :: %{ __struct__: module(), main_screen_buffer: Raxol.Terminal.ScreenBuffer.t(), alternate_screen_buffer: Raxol.Terminal.ScreenBuffer.t(), active_buffer_type: :main | :alternate, cursor: Raxol.Terminal.Cursor.Manager.t(), scroll_region: {non_neg_integer(), non_neg_integer()} | nil, style: Raxol.Terminal.ANSI.TextFormatting.text_style(), memory_limit: non_neg_integer(), charset_state: Raxol.Terminal.ANSI.CharacterSets.StateManager.charset_state(), mode_manager: Raxol.Terminal.ModeManager.t(), plugin_manager: Raxol.Plugins.Manager.Core.t(), options: map(), current_hyperlink_url: String.t() | nil, window_title: String.t() | nil, icon_name: String.t() | nil, tab_stops: MapSet.t(), output_buffer: String.t(), cursor_style: atom(), parser_state: map(), command_history: list(), max_command_history: non_neg_integer(), current_command_buffer: String.t(), saved_cursor: {non_neg_integer(), non_neg_integer()}, state_stack: any(), last_col_exceeded: boolean() }
Callbacks
@callback get_cursor_position(emulator :: t()) :: {non_neg_integer(), non_neg_integer()}
Gets the current cursor position (0-based).
Gets the current cursor visibility state.
@callback get_screen_buffer(emulator :: t()) :: Raxol.Terminal.ScreenBuffer.t()
Returns the currently active screen buffer.
@callback new() :: t()
Creates a new emulator with default dimensions and options.
@callback new(width :: non_neg_integer(), height :: non_neg_integer()) :: t()
Creates a new emulator with specified dimensions and default options.
@callback new( width :: non_neg_integer(), height :: non_neg_integer(), opts :: keyword() ) :: t()
Creates a new emulator with specified dimensions and options.
@callback new( width :: non_neg_integer(), height :: non_neg_integer(), session_id :: any(), client_options :: map() ) :: {:ok, t()} | {:error, any()}
Creates a new emulator with specified dimensions, session ID, and client options.
Processes input data (e.g., user typing, escape sequences).
@callback resize( emulator :: t(), new_width :: non_neg_integer(), new_height :: non_neg_integer() ) :: t()
Resizes the emulator's screen buffers.
@callback update_active_buffer( emulator :: t(), new_buffer :: Raxol.Terminal.ScreenBuffer.t() ) :: t()
Updates the currently active screen buffer in the emulator state.