Raxol.Terminal.ANSI.TerminalState (Raxol v0.2.0)

View Source

Manages terminal state for the terminal emulator. Handles saving and restoring terminal state, including cursor position, attributes, character sets, and screen modes.

Summary

Functions

Clears the terminal state stack.

Gets the number of saved states in the stack.

Checks if the terminal state stack is empty.

Gets the current terminal state stack.

Creates a new terminal state stack.

Restores the most recently saved terminal state from the stack. Returns the updated stack and the restored state.

Saves the current terminal state to the stack.

Types

saved_state()

@type saved_state() :: %{
  cursor: {non_neg_integer(), non_neg_integer()},
  attributes: map(),
  charset_state: Raxol.Terminal.ANSI.CharacterSets.charset_state(),
  mode_state: Raxol.Terminal.ANSI.ScreenModes.screen_state(),
  scroll_region: {non_neg_integer(), non_neg_integer()} | nil
}

state_stack()

@type state_stack() :: [saved_state()]

Functions

clear_state(stack)

@spec clear_state(state_stack()) :: state_stack()

Clears the terminal state stack.

count(stack)

@spec count(state_stack()) :: non_neg_integer()

Gets the number of saved states in the stack.

empty?(stack)

@spec empty?(state_stack()) :: boolean()

Checks if the terminal state stack is empty.

get_state_stack(stack)

@spec get_state_stack(state_stack()) :: state_stack()

Gets the current terminal state stack.

new()

@spec new() :: state_stack()

Creates a new terminal state stack.

restore_state(list)

@spec restore_state(state_stack()) :: {state_stack(), map() | nil}

Restores the most recently saved terminal state from the stack. Returns the updated stack and the restored state.

save_state(stack, state)

@spec save_state(state_stack(), map()) :: state_stack()

Saves the current terminal state to the stack.