Raxol.Terminal.Emulator.State (Raxol v0.4.0)

View Source

Handles state management for the terminal emulator. Provides functions for managing terminal state, modes, and character sets.

Summary

Functions

Gets the current character set state. Returns the current charset state.

Gets the current state from the state stack. Returns the current state or nil if stack is empty.

Gets the current hyperlink URL. Returns the current hyperlink URL or nil.

Gets the current memory limit. Returns the memory limit.

Gets the value of a terminal mode. Returns the mode value or nil if not set.

Gets the current tab stops. Returns the current tab stops.

Pops a state from the state stack. Returns {:ok, updated_emulator} or {:error, reason}.

Pushes a new state onto the state stack. Returns {:ok, updated_emulator} or {:error, reason}.

Sets the character set state. Returns {:ok, updated_emulator} or {:error, reason}.

Sets the current hyperlink URL. Returns {:ok, updated_emulator}.

Sets the memory limit for the terminal. Returns {:ok, updated_emulator} or {:error, reason}.

Sets a terminal mode. Returns {:ok, updated_emulator} or {:error, reason}.

Sets the tab stops for the terminal. Returns {:ok, updated_emulator}.

Functions

get_charset_state(emulator)

Gets the current character set state. Returns the current charset state.

get_current_state(emulator)

@spec get_current_state(Raxol.Terminal.Emulator.t()) ::
  Raxol.Terminal.ANSI.TerminalState.t() | nil

Gets the current state from the state stack. Returns the current state or nil if stack is empty.

get_memory_limit(emulator)

@spec get_memory_limit(Raxol.Terminal.Emulator.t()) :: non_neg_integer()

Gets the current memory limit. Returns the memory limit.

get_mode(emulator, mode)

@spec get_mode(Raxol.Terminal.Emulator.t(), atom()) :: boolean() | nil

Gets the value of a terminal mode. Returns the mode value or nil if not set.

get_tab_stops(emulator)

@spec get_tab_stops(Raxol.Terminal.Emulator.t()) :: MapSet.t()

Gets the current tab stops. Returns the current tab stops.

pop_state(emulator)

@spec pop_state(Raxol.Terminal.Emulator.t()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Pops a state from the state stack. Returns {:ok, updated_emulator} or {:error, reason}.

push_state(emulator)

@spec push_state(Raxol.Terminal.Emulator.t()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Pushes a new state onto the state stack. Returns {:ok, updated_emulator} or {:error, reason}.

set_charset_state(emulator, charset_state)

Sets the character set state. Returns {:ok, updated_emulator} or {:error, reason}.

set_memory_limit(emulator, limit)

@spec set_memory_limit(Raxol.Terminal.Emulator.t(), non_neg_integer()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Sets the memory limit for the terminal. Returns {:ok, updated_emulator} or {:error, reason}.

set_mode(emulator, mode, value)

@spec set_mode(Raxol.Terminal.Emulator.t(), atom(), boolean()) ::
  {:ok, Raxol.Terminal.Emulator.t()} | {:error, String.t()}

Sets a terminal mode. Returns {:ok, updated_emulator} or {:error, reason}.

set_tab_stops(emulator, tab_stops)

@spec set_tab_stops(Raxol.Terminal.Emulator.t(), MapSet.t()) ::
  {:ok, Raxol.Terminal.Emulator.t()}

Sets the tab stops for the terminal. Returns {:ok, updated_emulator}.