Raxol.Terminal.Emulator.Struct (Raxol v0.5.0)

View Source

Provides terminal emulator structure and related functionality.

Summary

Functions

Gets the active buffer from the emulator.

Gets the cursor position from the emulator.

Checks if scrolling is needed and performs it if necessary.

Creates a new terminal emulator with the given options.

Processes input for the emulator.

Updates the active buffer in the emulator.

Types

t()

@type t() :: %Raxol.Terminal.Emulator.Struct{
  active_buffer: Raxol.Terminal.ScreenBuffer.t(),
  active_buffer_type: :main | :alternate,
  alternate_screen_buffer: Raxol.Terminal.ScreenBuffer.t(),
  charset_state: %{
    g0: atom(),
    g1: atom(),
    g2: atom(),
    g3: atom(),
    gl: atom(),
    gr: atom(),
    single_shift: atom() | nil
  },
  client_options: map(),
  color_palette: map(),
  command: term(),
  command_history: [String.t()],
  current_command_buffer: String.t(),
  current_hyperlink: term(),
  current_hyperlink_url: String.t() | nil,
  cursor: %{
    position: {integer(), integer()},
    style: atom(),
    visible: boolean(),
    blink_state: boolean()
  },
  cursor_manager: term(),
  cursor_style: atom(),
  height: non_neg_integer(),
  icon_name: String.t() | nil,
  last_col_exceeded: boolean(),
  last_key_event: term(),
  main_screen_buffer: Raxol.Terminal.ScreenBuffer.t(),
  max_command_history: non_neg_integer(),
  memory_limit: non_neg_integer(),
  mode_manager: term(),
  output_buffer: String.t(),
  parser_state: term(),
  plugin_manager: term(),
  saved_cursor:
    %{
      position: {integer(), integer()},
      style: atom(),
      visible: boolean(),
      blink_state: boolean()
    }
    | nil,
  scroll_region: {non_neg_integer(), non_neg_integer()} | nil,
  scrollback_buffer: [Raxol.Terminal.ScreenBuffer.t()],
  scrollback_limit: non_neg_integer(),
  session_id: String.t(),
  state: atom(),
  state_stack: list(),
  style: map(),
  tab_stops: [integer()],
  width: non_neg_integer(),
  window_manager: term(),
  window_title: String.t() | nil
}

Functions

get_active_buffer(emulator)

@spec get_active_buffer(t()) :: Raxol.Terminal.ScreenBuffer.t()

Gets the active buffer from the emulator.

get_cursor_position(emulator)

@spec get_cursor_position(t()) :: {non_neg_integer(), non_neg_integer()}

Gets the cursor position from the emulator.

maybe_scroll(emulator)

@spec maybe_scroll(t()) :: t()

Checks if scrolling is needed and performs it if necessary.

new(width, height, opts \\ [])

@spec new(non_neg_integer(), non_neg_integer(), keyword()) :: t()

Creates a new terminal emulator with the given options.

process_input(emulator, input)

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

Processes input for the emulator.

update_active_buffer(emulator, buffer)

@spec update_active_buffer(t(), Raxol.Terminal.ScreenBuffer.t()) :: t()

Updates the active buffer in the emulator.