Raxol.Terminal.ModeManager (Raxol v0.4.0)

View Source

Manages terminal modes (DEC Private Modes, Standard Modes) and their effects.

This module centralizes the state and logic for various terminal modes, handling both simple flag toggles and modes with side effects on the emulator state (like screen buffer switching or resizing).

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 flag is currently enabled.

Creates a new mode manager state with default values.

Resets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.

Sets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.

Types

mode()

@type mode() :: atom()

t()

@type t() :: %Raxol.Terminal.ModeManager{
  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()) :: mode() | nil

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

lookup_standard(code)

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

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

mode_enabled?(mm_state, mode_flag)

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

Checks if a specific mode flag is currently enabled.

new()

@spec new() :: t()

Creates a new mode manager state with default values.

reset_mode(emulator, modes)

Resets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.

set_mode(emulator, modes)

Sets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.