Raxol.Terminal.Tab.Manager (Raxol v2.0.1)
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 next tab stop position from a specific current position.
Gets the configuration for a specific tab.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
Lists all tabs.
Creates a new tab manager instance.
Sets a horizontal tab stop at the current cursor position.
Sets a horizontal tab stop at the specified 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_next_tab_stop(t(), non_neg_integer()) :: pos_integer()
Gets the next tab stop position from a specific 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
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_cast/2.
Callback implementation for Raxol.Core.Behaviours.BaseManager.handle_manager_info/2.
@spec list_tabs(t()) :: %{required(tab_id()) => tab_config()}
Lists all tabs.
Parameters
manager- The tab manager instance
Returns
A map of tab IDs to tab configurations
@spec new() :: t()
Creates a new tab manager instance.
Sets a horizontal tab stop at the current cursor position.
@spec set_horizontal_tab(t(), non_neg_integer()) :: t()
Sets a horizontal tab stop at the specified 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
Updates the configuration for a specific tab.
Parameters
manager- The tab manager instancetab_id- The ID of the tabupdates- The configuration updates to apply
Returns
{:ok, updated_manager} on success
{:error, :tab_not_found} if the tab doesn't exist