Raxol.Terminal.Tab.Manager (Raxol v0.5.0)
View SourceManages terminal tabs and their associated sessions. This module handles:
- Creation, deletion, and switching of terminal tabs
- Tab state and configuration management
- Tab stop management for terminal operations
Summary
Functions
Returns a specification to start this module under a supervisor.
Clears all tab stops.
Clears a tab stop at the specified position.
Creates a new tab with the given configuration.
Deletes a tab by its ID.
Gets the active tab ID.
Gets the next tab stop position from the current position.
Gets the configuration for a specific tab.
Lists all tabs.
Creates a new tab manager instance.
Sets a horizontal tab stop at the current cursor position.
Switches to a different tab.
Updates the configuration for a specific tab.
Types
@type t() :: %Raxol.Terminal.Tab.Manager{ active_tab: tab_id() | nil, default_tab_width: pos_integer(), next_tab_id: non_neg_integer(), tab_stops: MapSet.t(), tabs: %{required(tab_id()) => tab_config()} }
@type tab_id() :: String.t()
@type tab_state() :: :active | :inactive | :hidden
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Clears all tab stops.
@spec clear_tab_stop(t(), pos_integer()) :: t()
Clears a tab stop at the specified position.
@spec create_tab(t(), tab_config() | nil) :: {:ok, tab_id(), t()} | {:error, term()}
Creates a new tab with the given configuration.
Parameters
manager
- The tab manager instanceconfig
- The tab configuration (optional)
Returns
{:ok, tab_id, updated_manager}
on success
{:error, reason}
on failure
Deletes a tab by its ID.
Parameters
manager
- The tab manager instancetab_id
- The ID of the tab to delete
Returns
{:ok, updated_manager}
on success
{:error, :tab_not_found}
if the tab doesn't exist
Gets the active tab ID.
Parameters
manager
- The tab manager instance
Returns
The active tab ID or nil if no tab is active
@spec get_next_tab_stop(t()) :: pos_integer()
Gets the next tab stop position from the current position.
@spec get_tab_config(t(), tab_id()) :: {:ok, tab_config()} | {:error, :tab_not_found}
Gets the configuration for a specific tab.
Parameters
manager
- The tab manager instancetab_id
- The ID of the tab
Returns
{:ok, config}
on success
{:error, :tab_not_found}
if the tab doesn't exist
@spec list_tabs(t()) :: [tab_config()]
Lists all tabs.
Parameters
manager
- The tab manager instance
Returns
A list of tab configurations
@spec new() :: t()
Creates a new tab manager instance.
Sets a horizontal tab stop at the current cursor position.
Switches to a different tab.
Parameters
manager
- The tab manager instancetab_id
- The ID of the tab to switch to
Returns
{:ok, updated_manager}
on success
{:error, :tab_not_found}
if the tab doesn't exist
@spec update_tab_config(t(), tab_id(), tab_config()) :: {:ok, t()} | {:error, :tab_not_found}
Updates the configuration for a specific tab.
Parameters
manager
- The tab manager instancetab_id
- The ID of the tabconfig
- The new configuration
Returns
{:ok, updated_manager}
on success
{:error, :tab_not_found}
if the tab doesn't exist