A single tab in the tab bar.
Each tab has a unique id, a kind (:file or :agent), a display label,
and a context map that stores snapshotted per-tab state when the tab is
inactive. The active tab's context is "live" on EditorState; inactive
tabs carry a frozen snapshot that gets restored when you switch to them.
Context format
The canonical context is a flat map with per-tab fields (buffers, windows, vim state, viewport, etc.) stored directly. Legacy contexts with nested structure are auto-migrated on first restore.
Summary
Types
Agent tab status (nil for file tabs).
Snapshotted per-tab state.
Workspace group id. 0 = manual/ungrouped workspace.
Unique tab identifier.
Tab kind.
A tab.
Functions
Returns true if this is an agent tab.
Returns true if this is a file tab.
Creates a new agent tab.
Creates a new file tab.
Sets the agent status on a tab (for tab bar rendering).
Sets the attention flag (agent needs user input).
Stores a context snapshot into the tab.
Sets the workspace group id.
Updates the tab's label.
Sets the session pid for an agent tab.
Types
@type agent_status() :: :idle | :thinking | :tool_executing | :error | nil
Agent tab status (nil for file tabs).
@type context() :: %{ optional(:keymap_scope) => atom(), optional(:buffers) => term(), optional(:windows) => term(), optional(:file_tree) => term(), optional(:viewport) => term(), optional(:mouse) => term(), optional(:highlight) => term(), optional(:lsp_pending) => term(), optional(:completion) => term(), optional(:completion_trigger) => term(), optional(:injection_ranges) => term(), optional(:search) => term(), optional(:pending_conflict) => term(), optional(:editing) => MingaEditor.VimState.t(), optional(:vim) => MingaEditor.VimState.t(), optional(:document_highlights) => term(), optional(:agent_ui) => term(), optional(:mode) => atom(), optional(:mode_state) => term(), optional(:reg) => term(), optional(:marks) => term(), optional(:last_jump_pos) => term(), optional(:last_find_char) => term(), optional(:change_recorder) => term(), optional(:macro_recorder) => term() }
Snapshotted per-tab state.
The context stores per-tab fields directly (buffers, windows, mode, etc.). Empty context means a brand-new tab.
Legacy contexts with nested structure (old snapshot format) or bare fields (oldest format) are auto-migrated on first restore.
@type group_id() :: non_neg_integer()
Workspace group id. 0 = manual/ungrouped workspace.
@type id() :: pos_integer()
Unique tab identifier.
@type kind() :: :file | :agent
Tab kind.
@type t() :: %MingaEditor.State.Tab{ agent_status: agent_status(), attention: boolean(), context: context(), group_id: group_id(), id: id(), kind: kind(), label: String.t(), session: pid() | nil }
A tab.
Functions
Returns true if this is an agent tab.
Returns true if this is a file tab.
Creates a new agent tab.
Creates a new file tab.
@spec set_agent_status(t(), agent_status()) :: t()
Sets the agent status on a tab (for tab bar rendering).
Sets the attention flag (agent needs user input).
Stores a context snapshot into the tab.
Sets the workspace group id.
Updates the tab's label.
Sets the session pid for an agent tab.