Tagged-union data struct for the global status bar.
Computed once per frame from editor state and consumed by both rendering
paths: Chrome.TUI feeds it to Modeline.render/5 as cell draws;
Emit.GUI encodes it as the 0x76 structured opcode for SwiftUI.
The two variants reflect the two kinds of focused window content:
{:buffer, t:buffer_data()}— a normal buffer window{:agent, t:agent_data()}— an agent chat window
Summary
Types
Data for a focused agent chat window. Includes background buffer context so the status bar layout stays stable across mode switches.
Data for a focused buffer window.
Git diff summary: {added, modified, deleted} line counts.
LSP connection status.
Parser availability status.
Tagged union: buffer or agent variant.
Functions
Returns the first diagnostic message on the given cursor line, formatted as a human-readable hint string (icon + message + source). Returns nil if no diagnostics exist on that line.
Returns the diagnostic count 4-tuple for the active buffer, or nil.
Builds the status bar data from the current editor state.
Returns {branch_name | nil, diff_summary | nil} for the status bar.
Converts a StatusBar.Data.t() to the map shape expected by Modeline.render/5.
Types
@type agent_data() :: %{ mode: Minga.Mode.mode(), mode_state: Minga.Mode.state() | nil, model_name: String.t(), session_status: MingaEditor.State.Agent.status(), message_count: non_neg_integer(), macro_recording: {true, String.t()} | false, agent_status: MingaEditor.State.Agent.status(), agent_theme_colors: MingaEditor.UI.Theme.Agent.t() | nil, cursor_line: non_neg_integer(), cursor_col: non_neg_integer(), line_count: non_neg_integer(), file_name: String.t(), filetype: atom(), dirty: boolean(), git_branch: String.t() | nil, git_diff_summary: git_diff_summary(), diagnostic_counts: {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil, diagnostic_hint: String.t() | nil, lsp_status: lsp_status(), parser_status: parser_status(), buf_index: pos_integer(), buf_count: non_neg_integer(), status_msg: String.t() | nil }
Data for a focused agent chat window. Includes background buffer context so the status bar layout stays stable across mode switches.
@type buffer_data() :: %{ mode: Minga.Mode.mode(), mode_state: Minga.Mode.state() | nil, cursor_line: non_neg_integer(), cursor_col: non_neg_integer(), line_count: non_neg_integer(), file_name: String.t(), filetype: atom(), dirty: boolean(), git_branch: String.t() | nil, git_diff_summary: git_diff_summary(), diagnostic_counts: {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil, diagnostic_hint: String.t() | nil, lsp_status: lsp_status(), parser_status: parser_status(), buf_index: pos_integer(), buf_count: non_neg_integer(), macro_recording: {true, String.t()} | false, agent_status: MingaEditor.State.Agent.status(), agent_theme_colors: MingaEditor.UI.Theme.Agent.t() | nil, status_msg: String.t() | nil }
Data for a focused buffer window.
@type git_diff_summary() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil
Git diff summary: {added, modified, deleted} line counts.
@type lsp_status() :: :ready | :initializing | :starting | :error | :none
LSP connection status.
@type parser_status() :: :available | :unavailable | :restarting
Parser availability status.
@type t() :: {:buffer, buffer_data()} | {:agent, agent_data()}
Tagged union: buffer or agent variant.
Functions
@spec cursor_line_diagnostic_hint(pid() | nil, non_neg_integer()) :: String.t() | nil
Returns the first diagnostic message on the given cursor line, formatted as a human-readable hint string (icon + message + source). Returns nil if no diagnostics exist on that line.
Used by the GUI status bar center segment to show diagnostic context when idle (no status message, no active minibuffer).
@spec diagnostic_modeline_data(pid() | nil) :: {non_neg_integer(), non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil
Returns the diagnostic count 4-tuple for the active buffer, or nil.
@spec from_state(MingaEditor.State.t() | map()) :: t()
Builds the status bar data from the current editor state.
Inspects the active window's content type and returns the appropriate tagged variant. Called once per render frame before the Chrome stage.
@spec git_modeline_data(pid() | nil) :: {String.t() | nil, git_diff_summary()}
Returns {branch_name | nil, diff_summary | nil} for the status bar.
@spec to_modeline_data(t()) :: MingaEditor.Shell.Traditional.Modeline.modeline_data()
Converts a StatusBar.Data.t() to the map shape expected by Modeline.render/5.
Both variants carry the same buffer fields and produce identical modeline data.