Raxol.Terminal.Emulator.Struct (Raxol v2.0.1)

View Source

Provides terminal emulator structure and related functionality.

Summary

Functions

Gets the cursor position from the emulator.

Gets the active buffer from the emulator.

Checks if scrolling is needed and performs it if necessary.

Moves the cursor to the specified position.

Moves the cursor down by the specified number of lines.

Moves the cursor left by the specified number of columns.

Moves the cursor right by the specified number of columns.

Moves the cursor to the specified position.

Moves the cursor to the specified column.

Moves the cursor to the start of the current line.

Moves the cursor up by the specified number of lines.

Creates a new terminal emulator with the given options.

Processes input for the emulator.

Resets a terminal mode.

Sets the character set for the emulator.

Sets a terminal mode.

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(),
  buffer: term(),
  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()],
  config: term(),
  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(),
  event: term(),
  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_cursor_position(emulator)

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

Gets the cursor position from the emulator.

get_screen_buffer(emulator)

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

Gets the active buffer from the emulator.

maybe_scroll(emulator)

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

Checks if scrolling is needed and performs it if necessary.

move_cursor(emulator, row, col)

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

Moves the cursor to the specified position.

move_cursor_down(emulator, lines, width, height)

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

Moves the cursor down by the specified number of lines.

move_cursor_left(emulator, cols, width, height)

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

Moves the cursor left by the specified number of columns.

move_cursor_right(emulator, cols, width, height)

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

Moves the cursor right by the specified number of columns.

move_cursor_to(emulator, arg, width, height)

@spec move_cursor_to(t(), {integer(), integer()}, integer(), integer()) :: t()

Moves the cursor to the specified position.

move_cursor_to_column(emulator, column, width, height)

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

Moves the cursor to the specified column.

move_cursor_to_line_start(emulator)

@spec move_cursor_to_line_start(t()) :: t()

Moves the cursor to the start of the current line.

move_cursor_up(emulator, lines, width, height)

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

Moves the cursor up by the specified number of lines.

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.

reset_mode(emulator, mode)

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

Resets a terminal mode.

set_charset(emulator, charset)

@spec set_charset(t(), atom()) :: {:ok, t()} | {:error, atom(), t()}

Sets the character set for the emulator.

set_mode(emulator, mode)

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

Sets a terminal mode.

update_active_buffer(emulator, new_buffer)

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

Updates the active buffer in the emulator.