Raxol.Terminal.ModeState (Raxol v0.5.0)

View Source

Manages terminal mode state and transitions.

This module is responsible for:

  • Managing mode state
  • Handling mode transitions
  • Validating mode changes
  • Providing mode state queries

Summary

Functions

Looks up a DEC private mode code and returns the corresponding mode atom.

Looks up a standard mode code and returns the corresponding mode atom.

Checks if a specific mode is enabled.

Creates a new mode state with default values.

Resets the alternate buffer mode.

Resets a mode to disabled state.

Sets the alternate buffer mode.

Sets a mode to enabled state.

Types

t()

@type t() :: %Raxol.Terminal.ModeState{
  active_buffer_type: term(),
  alt_screen_mode: term(),
  alternate_buffer_active: term(),
  auto_repeat_mode: term(),
  auto_wrap: term(),
  bracketed_paste_mode: term(),
  column_width_mode: term(),
  cursor_keys_mode: term(),
  cursor_visible: term(),
  focus_events_enabled: term(),
  insert_mode: term(),
  interlacing_mode: term(),
  line_feed_mode: term(),
  mouse_report_mode: term(),
  origin_mode: term(),
  screen_mode_reverse: term()
}

Functions

lookup_private(code)

@spec lookup_private(integer()) :: atom() | nil

Looks up a DEC private mode code and returns the corresponding mode atom.

lookup_standard(code)

@spec lookup_standard(integer()) :: atom() | nil

Looks up a standard mode code and returns the corresponding mode atom.

mode_enabled?(state, mode)

@spec mode_enabled?(t(), atom()) :: boolean()

Checks if a specific mode is enabled.

Parameters

  • state - The current mode state
  • mode - The mode to check

Returns

  • boolean() - Whether the mode is enabled

new()

@spec new() :: t()

Creates a new mode state with default values.

reset_alternate_buffer_mode(state)

@spec reset_alternate_buffer_mode(t()) :: t()

Resets the alternate buffer mode.

Parameters

  • state - The current mode state

Returns

  • t() - The updated mode state

reset_mode(state, mode)

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

Resets a mode to disabled state.

Parameters

  • state - The current mode state
  • mode - The mode to disable

Returns

  • t() - The updated mode state

set_alternate_buffer_mode(state, type)

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

Sets the alternate buffer mode.

Parameters

  • state - The current mode state
  • type - The alternate buffer mode type

Returns

  • t() - The updated mode state

set_mode(state, mode)

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

Sets a mode to enabled state.

Parameters

  • state - The current mode state
  • mode - The mode to enable

Returns

  • t() - The updated mode state