Raxol.Terminal.ModeManager (Raxol v2.0.1)
View SourceManages 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
Gets the mode manager.
Gets the set modes.
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 the given mode is set.
Creates a new mode manager with default values.
Resets all modes.
Resets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.
Restores the saved modes.
Restores the previously saved terminal state.
Saves the current modes.
Saves the current terminal state.
Sets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.
Sets a mode with a value and options.
Sets a mode with a value and private flag.
Sets a private mode with a value.
Sets a standard mode with a value.
Updates the auto repeat mode.
Updates the auto wrap mode.
Updates the bracketed paste mode.
Updates the column width 132 mode.
Updates the cursor visible mode.
Updates the insert mode.
Updates the interlacing mode.
Updates the line feed mode.
Updates the mode manager.
Updates the origin mode.
Updates the screen mode reverse.
Types
@type mode() :: atom()
@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
Gets the mode manager.
Gets the set modes.
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 the given mode is set.
@spec new() :: t()
Creates a new mode manager with default values.
Resets all modes.
@spec reset_mode(Raxol.Terminal.Emulator.t(), [mode()], atom() | nil) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, term()}
Resets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.
Restores the saved modes.
@spec restore_state(Raxol.Terminal.Emulator.t()) :: Raxol.Terminal.Emulator.t()
Restores the previously saved terminal state.
Saves the current modes.
@spec save_state(Raxol.Terminal.Emulator.t()) :: Raxol.Terminal.Emulator.t()
Saves the current terminal state.
@spec set_mode(Raxol.Terminal.Emulator.t(), [mode()], atom() | nil) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, term()}
Sets one or more modes. Dispatches to specific handlers. Returns potentially updated Emulator state if side effects occurred.
@spec set_mode(Raxol.Terminal.Emulator.t(), atom(), any(), keyword()) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, term()}
Sets a mode with a value and options.
@spec set_mode_with_private(Raxol.Terminal.Emulator.t(), mode(), boolean(), boolean()) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, term()}
Sets a mode with a value and private flag.
@spec set_private_mode(Raxol.Terminal.Emulator.t(), mode(), boolean()) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, term()}
Sets a private mode with a value.
@spec set_standard_mode(Raxol.Terminal.Emulator.t(), mode(), boolean()) :: {:ok, Raxol.Terminal.Emulator.t()} | {:error, term()}
Sets a standard mode with a value.
@spec update_auto_repeat_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the auto repeat mode.
@spec update_auto_wrap_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the auto wrap mode.
@spec update_bracketed_paste_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the bracketed paste mode.
@spec update_column_width_132(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the column width 132 mode.
@spec update_cursor_visible(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the cursor visible mode.
@spec update_insert_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the insert mode.
@spec update_interlacing_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the interlacing mode.
@spec update_line_feed_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the line feed mode.
Updates the mode manager.
@spec update_origin_mode(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the origin mode.
@spec update_screen_mode_reverse(Raxol.Terminal.Emulator.t(), boolean()) :: Raxol.Terminal.Emulator.t()
Updates the screen mode reverse.