Raxol.Terminal.CharsetManager (Raxol v2.0.1)

View Source

Manages the terminal character sets.

Summary

Functions

Applies a single shift to the state.

Clears the single shift after processing one character.

Designates a charset for the given g-set.

Gets the current g-set.

Gets the designated charset for the given g-set.

Gets the current single shift.

Gets the current state.

Invokes the given g-set.

Resets the state to its initial values.

Updates the state.

Types

t()

@type t() :: %Raxol.Terminal.CharsetManager{
  designated_charsets: map(),
  g_set: atom(),
  single_shift: atom() | nil,
  state: map()
}

Functions

apply_single_shift(state, shift)

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

Applies a single shift to the state.

Single shift temporarily invokes G2 or G3 for the next character only. Valid shifts are :g2 (SS2) and :g3 (SS3).

clear_single_shift(state)

@spec clear_single_shift(t()) :: t()

Clears the single shift after processing one character.

This should be called after processing a character when a single shift is active.

designate_charset(state, g_set, charset)

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

Designates a charset for the given g-set.

get_current_g_set(state)

@spec get_current_g_set(t()) :: atom()

Gets the current g-set.

get_designated_charset(state, g_set)

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

Gets the designated charset for the given g-set.

get_single_shift(state)

@spec get_single_shift(t()) :: atom() | nil

Gets the current single shift.

Returns the currently active single shift (:g2 or :g3), or nil if no single shift is active.

get_state(state)

@spec get_state(t()) :: map()

Gets the current state.

invoke_g_set(state, g_set)

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

Invokes the given g-set.

reset_state(state)

@spec reset_state(t()) :: t()

Resets the state to its initial values.

update_state(state, new_state)

@spec update_state(t(), map()) :: t()

Updates the state.