ui

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 33 Imported by: 0

README

ui

Bubble Tea view components. Everything here renders core.InstanceView copies that app/ hands in: the rail, cards, overview, menu, split pane, panes and workbench hold copies, never an instance, and none of them mutates the model. Event handling lives in app/.

Layout

  • Rail (list.go, 20% width, hidden with \). It reads its rows from an InstanceSource: the slot's view store with the TUI's overlays and draft row (app's slotRows). The list only reads it, so adds, removals and replacements are edits of the store. It keeps the selection by InstanceID (SelectID), re-resolved on every read (resolveSelection): a row added or removed above it moves its index, not the selection, and a selection whose row is removed moves to the row that slid into its place, or the new last row (lostSelectionRow). Rows are live mini-cards built by card.go (title and output tail, with a left accent bar: gold = needs input, blue = selected, green = running, purple = workspace terminal), with dimmed peer-workspace summaries at the bottom. Branch and diff stats live in the agent pane's title and the overview cards, not the rail. A Prompting card shows Claude's own wait reason verbatim, truncated, in place of the generic "awaiting input" (CardData, statusLabel), and a stopped Claude session's card shows the end of its last message (MessageTailLines).
  • Right panel (split_pane.go, 80% width): agent and terminal panes stacked vertically (70/30 default split, resized with ctrl+up/ctrl+down, terminal hidden with T) and a hotkey-toggled diff overlay (diff.go). SplitPane.HitTest maps a cell to pane content for mouse selection, which works over the rendered text (selection.go).
  • Overview (overview.go): the fleet card grid of overview mode.
  • Workbench (workbench.go): the right half of workbench mode, with markdown (markdown.go; Glamour styles in markdown_style.go), diff, files, terminal and review tabs. It holds the review pane through the ReviewPane interface.
  • quick_input.go is the inline input bar that sends text to tmux; workspace_tab_bar.go renders the workspace tabs; account_strip.go the accounts row (AccountStrip, whose SetWarning leads the row with the credential-override warning); menu.go the bottom menu; err.go the error and info bar.

Panes and scrolling

  • panes.go holds PaneClients, the agent panes' attach clients keyed by tmux session name (two open workspaces sharing a title share one client), and Pane, the surface every agent-pane render, scroll, cursor, mouse event, paste, inline-attach key and status scrape goes through. Ensure attaches a client; Retain and Replace drop clients from the registry and hand them back for closing; Alive and Pane.Attached say whether a client is usable (TmuxSession.Attached). Ensure leaves a client whose pump exited on its own within quickExitHoldoff of attaching to the health tick, warning once per burst (pane.client_exited_after_attach).
  • scroll.go defines ScrollModel, the shared scroll state machine (offset, anchoring, wheel damping, alt-screen routing). PreviewPane (the agent pane, preview.go) and terminal.go's TerminalPane delegate to it on the emulator path, where it windows the history seeded at attach plus the emulator's scrollback and screen (RenderWindow, ScrollbackLen). Each pane falls back to legacy capture-pane windowing when its client has no emulator (LOOM_PANE_RENDERER=snapshot, Windows).
  • terminal.go renders a pane from the embedded VT emulator, with a jump-to-bottom footer and mouse drag-select/copy. The terminal pane also owns the loom_term_ shells, one per started row: it starts one only for an active row (ensureSessionLocked) and lets go of them with DetachAll/DetachExcept, which leave the shell running.

Themes

theme.go defines the color-role vars, ApplyTheme and RegisterThemeHook. Every theme-derived style is built inside a hook, so a theme picked from the settings overlay's Theme row repaints at once.

Sub-packages

  • ui/overlay/ — modal dialogs: text input, text, confirmation, branch, profile and workspace pickers, file explorer, settings (with the Accounts and Profiles managers and the Claude Preferences screen), merge picker, Session Launch Options and issue picker. The settings overlay's SetAccountNotice puts a screen-wide notice above the Accounts screen's rows (AccountsManager.SetNotice); Session Launch Options' SetAccountNotice puts one under its Account row.
  • ui/review/ (package reviewui) — the embedded review pane, vendored from kevindutra/crit (MIT, see NOTICE.md) with theme-hooked styles: doc-review and code-review modes behind one Pane type, which implements ui.ReviewPane. NewDocPane/NewCodePane build it; LoadCmd reads documents, diffs and review state off the Update goroutine; Busy() reports a capture-all state (comment modal, tab search, visual selection); while idle, claimsIdleKey claims only the keys the pane acts on; persistence results arrive as SavedMsg. Package ui holds only the ReviewPane interface, because reviewui imports ui.

Tests

ui/main_test.go isolates the package from the developer's tmux server and loom dirs. Fake attach PTYs (here and in app/) are internal/testpty pairs, open until the test ends or closes the peer: a /dev/null PTY reads EOF at once, which a client takes for a dead session (Attached false). Rendering geometry is measured, not reasoned about: ui/pane_border_test.go, ui/card_test.go and ui/overview_test.go render and measure.

Documentation

Overview

Package ui holds Loom's Bubble Tea view components.

The layout splits the screen into a left-hand List of instances (≈20 % width) and a right-hand SplitPane (≈80 %) with stacked Agent and Terminal panes plus a hotkey-toggled diff overlay. Secondary widgets — the workspace tab bar, quick-input bar, and menu bar — compose around that main split.

Modal dialogs (text input, confirmation, branch/profile/workspace pickers) live in ui/overlay. Renderers here are pure: they read core.InstanceView values and emit strings; they do not mutate instances or spawn goroutines. Event handling happens in the app layer.

Index

Constants

View Source
const (
	// RailCardLines is lines per DensityRail card incl. trailing gap.
	RailCardLines = 3
	// RailHeaderLines is the section-label header at the top of the rail.
	RailHeaderLines = 2
)

Rail layout constants (used by List height math).

View Source
const (
	// ListWidthPercent is the fraction of terminal width allotted to the
	// left-hand session list.
	ListWidthPercent = 0.2

	// SplitAgentPercent is the fraction of the right-hand pane height
	// given to the agent view; the terminal pane gets the remainder.
	SplitAgentPercent = 0.7

	// OverlayWidthPercent / OverlayHeightPercent size modal overlays
	// (text input, confirmation, pickers).
	OverlayWidthPercent  = 0.6
	OverlayHeightPercent = 0.4

	// PreviewWidthPercent sizes the preview-pane capture column.
	PreviewWidthPercent = 0.9
)

Layout proportions used across the TUI. Keeping them centralized prevents drift between app.go's sizing math and the component-level calculations.

View Source
const (
	FocusAgent int = iota
	FocusTerminal
)

FocusAgent and FocusTerminal are the SplitPane focus values: the top (agent) or bottom (terminal) pane. Focus determines which pane receives scroll and attach keypresses.

View Source
const DefaultThemeName = "afterglow"

DefaultThemeName is applied at startup when config names no theme (or an unknown one).

View Source
const MarkdownMaxBytes = 256 * 1024

MarkdownMaxBytes caps how much of a document is fed to glamour; the tail beyond it is dropped with a truncation notice. Glamour renders synchronously on the Update goroutine (lazily, once per content/width/theme change), so the cap bounds that stall.

View Source
const UsageStaleAfter = 4 * time.Minute

UsageStaleAfter is when a usage sample renders dimmed with its age: two of app's 2-minute probe intervals.

Variables

View Source
var (
	Ground      = current.Ground
	Panel       = current.Panel
	Text        = current.Text
	Dim         = current.Dim
	Faint       = current.Faint
	Rule        = current.Rule
	Accent      = current.Accent
	Attention   = current.Attention
	Highlight   = current.Highlight
	OK          = current.OK
	ErrorColor  = current.Error
	Workspace   = current.Workspace
	Info        = current.Info
	SelectionBg = current.SelectionBg
	SelectionFg = current.SelectionFg
)

Active color roles. Reassigned (main goroutine only: startup, or the settings overlay's Update-goroutine handler) by ApplyTheme.

View Source
var (
	AdditionStyle, DeletionStyle, HunkStyle lipgloss.Style
)

AdditionStyle, DeletionStyle, and HunkStyle are the lipgloss styles applied line-by-line by colorizeDiff to render a colorized git diff. They are exported so tests and callers composing their own diff renderers can reuse the same palette.

View Source
var FallBackText = `` /* 637-byte string literal not displayed */

FallBackText is the ASCII splash rendered in empty-state panes when no instance is selected or a newly created instance has not yet started.

Functions

func AccountUsageText added in v0.14.0

func AccountUsageText(s AccountStatus, now time.Time) string

AccountUsageText is the plain usage summary: "5h 12% · 7d 31%", plus " · 9m ago" once stale; "logged out"; "n/a" when plan limits don't apply (API-key auth); "—" before the first successful probe.

func AdjustPreviewWidth

func AdjustPreviewWidth(width int) int

AdjustPreviewWidth adjusts the width of the preview pane per PreviewWidthPercent.

func ApplyTheme added in v0.13.0

func ApplyTheme(name string) bool

ApplyTheme activates the named theme, reassigns every role var, and re-runs all registered hooks. Unknown or empty names activate the default theme and return false. Main-goroutine only.

func ContentTailLines added in v0.13.0

func ContentTailLines(screen string, n int) []string

ContentTailLines is TailLines minus trailing agent chrome. Coding-agent TUIs (Claude Code and friends) pin an input area — delimited by horizontal rules or a box — plus footer lines to the bottom of the screen, so a bottom-anchored tail shows only that chrome and never the conversation. This scans the trailing lines for that shape and anchors the tail above it; a dialog rendered inside the input area (permission prompt) is real content, so its interior is returned instead. Any screen without the shape (shells, aider, half-drawn panes) falls back to the plain TailLines behavior.

func CurrentThemeName added in v0.13.0

func CurrentThemeName() string

CurrentThemeName returns the active theme's name.

func DisplayIndex added in v0.3.0

func DisplayIndex(items []core.InstanceView, i int) int

DisplayIndex returns the 1-based number shown in the list UI for the item at position i in items. A leading workspace terminal (position 0) is numbered 0, not 1, so every other item's displayed number is offset by one relative to its slice position. Exported so callers that build a session-index picker from the same items (e.g. the merge picker) label rows with the exact number the user already saw in the main list.

func IsMarkdownPath added in v0.13.0

func IsMarkdownPath(path string) bool

IsMarkdownPath reports whether path has a markdown extension.

func MessageTailLines added in v0.14.0

func MessageTailLines(msg string, n int) []string

MessageTailLines returns the last n lines of a message Claude wrote, for a card's tail: blank and code-fence lines are dropped, a heading's leading #s trimmed, and every line sanitized, since the text is model-written. Returns nil when nothing is left or n < 1.

func RegisterThemeHook added in v0.13.0

func RegisterThemeHook(fn func())

RegisterThemeHook registers fn to rebuild theme-derived styles and invokes it immediately. Call from init() in the file that owns the styles. Main-goroutine only.

func RenderCard added in v0.13.0

func RenderCard(d CardData, density CardDensity, width int) string

RenderCard renders d at the given density and total width. DensityCard is rendered by Overview (overview.go) which owns border/grid layout; RenderCard handles DensityLine and DensityRail.

func SetShowAccounts added in v0.14.0

func SetShowAccounts(on bool)

SetShowAccounts turns account badges on or off.

func ShowAccounts added in v0.14.0

func ShowAccounts() bool

ShowAccounts reports whether account badges are on.

func SortForOverview added in v0.13.0

func SortForOverview(items []core.InstanceView) []int

SortForOverview returns display order (indices into items) for the overview grid and overview cursor movement: workspace terminal pinned first, then attention > running/loading > ready > paused/recoverable, stable by title within a tier. Deleting sorts last.

func TailLines added in v0.13.0

func TailLines(screen string, n int) []string

TailLines returns the last n non-blank-tail lines of screen with ANSI styling stripped (card chrome owns the styling; embedded SGR would bleed). C0 controls survive ansi.Strip, so tabs are normalized to a single space and carriage returns dropped — emulator output never contains them today, but the helper is exported and generic. Returns nil for an effectively empty screen.

func ThemeNames added in v0.13.0

func ThemeNames() []string

ThemeNames returns all registered theme names, sorted.

Types

type AccountStatus added in v0.14.0

type AccountStatus struct {
	Name string
	// IsDefault marks the account new sessions preselect ("*").
	IsDefault bool
	// Usage is the last good probe; a zero At means never probed.
	Usage account.Usage
	// Failing reports that the latest probe failed (Usage is older).
	Failing bool
	// LoggedOut reports that `claude auth status` said so.
	LoggedOut bool
}

AccountStatus is the render-ready view of one Claude account, shared by the usage strip, the Launch Options Account row and the Accounts screen.

type AccountStrip added in v0.14.0

type AccountStrip struct {
	// contains filtered or unexported fields
}

AccountStrip is the one-row usage summary above the workspace tab bar: every Claude account with its 5-hour and weekly plan usage. It shows only when an extra account exists (two or more accounts).

func NewAccountStrip added in v0.14.0

func NewAccountStrip() *AccountStrip

NewAccountStrip creates an empty (hidden) strip.

func (*AccountStrip) Height added in v0.14.0

func (s *AccountStrip) Height() int

Height is 1 while the strip shows, else 0.

func (*AccountStrip) SetAccounts added in v0.14.0

func (s *AccountStrip) SetAccounts(a []AccountStatus)

SetAccounts replaces the accounts shown, default first.

func (*AccountStrip) SetWarning added in v0.14.0

func (s *AccountStrip) SetWarning(w string)

SetWarning sets a condition that makes the usage misleading, such as a credential in loom's environment that every account runs as; "" clears it. It leads the row, marked "⚠", and at narrow widths the usage is cut before it is. It never shows the strip on its own.

func (*AccountStrip) SetWidth added in v0.14.0

func (s *AccountStrip) SetWidth(w int)

SetWidth sets the render width.

func (*AccountStrip) String added in v0.14.0

func (s *AccountStrip) String() string

String renders the strip at the current time; "" when hidden.

type CardData added in v0.13.0

type CardData struct {
	Title               string
	Index               int // 1-based display number (0 for workspace terminal)
	Status              session.Status
	IsWorkspaceTerminal bool
	BellPending         bool
	Selected            bool
	Branch              string
	DiffAdded           int
	DiffRemoved         int
	HasDiff             bool
	TailLines           []string
	StatusAge           time.Duration // 0 = unknown/not applicable
	Spinner             string        // current spinner frame for Running/Loading
	// WaitReason is Claude's own account of what a Prompting session is
	// blocked on ("permission: Bash", "sandbox request"), from its hooks
	// or the agent roster, via sanitizeCardText. Empty when unknown —
	// non-Claude agents, and any status the pane scraper decided.
	WaitReason string
	// Subagents lists the session's live subagents and teammates, working
	// first, with names and descriptions passed through sanitizeCardText.
	// Empty for most cards; see core.InstanceView.Subagents.
	Subagents []SubagentRow
	// GitHub is the poller's join for this session (issue, PR, checks).
	// Known=false renders nothing. See app/github.go.
	GitHub github.State
	// Ahead/Behind count commits relative to the base branch; HasParity
	// is false until a count succeeded.
	Ahead, Behind int
	HasParity     bool
	// Account is the Claude account badge ("max-2", "default"); empty when
	// badges are off (no extra account) or the session isn't Claude.
	Account string
}

CardData is the render-ready view-model for one instance card. It is plain data so RenderCard stays a pure, table-testable function; build it from a live instance with BuildCardData.

func BuildCardData added in v0.13.0

func BuildCardData(v core.InstanceView, pane Pane, selected bool, spinnerFrame string, tailN int) CardData

BuildCardData snapshots v into a CardData. pane is v's pane (PaneClients.For), and the live tail is read from its in-memory emulator screen, so calling this per visible card per frame forks no subprocesses. Instances on the snapshot path render their status label instead of a tail. spinnerFrame is the current spinner view ("" when unavailable). tailN caps the tail; 0 skips the screen read entirely (DensityLine callers). When Claude's last message is current and the session is not working, the tail is the end of that message instead, on either path.

func (CardData) NeedsAttention added in v0.13.0

func (d CardData) NeedsAttention() bool

NeedsAttention reports whether this card should carry the Attention accent — the only loud signal in the UI. A Deleting instance never needs attention: a stale bell on a mid-kill card must not paint it gold or float it into the attention tier.

type CardDensity added in v0.13.0

type CardDensity int

CardDensity selects how much of an instance a card shows.

const (
	// DensityLine is a one-line row (height-starved fallback).
	DensityLine CardDensity = iota
	// DensityRail is the focus-mode rail mini-card: title line + one
	// tail/status line, with a left accent bar.
	DensityRail
	// DensityCard is the overview card: bordered box with metadata and
	// a multi-line tail (rendered by Overview in overview.go).
	DensityCard
)

type DiffPane

type DiffPane struct {
	// contains filtered or unexported fields
}

DiffPane renders the colorized git diff overlay shown when the user toggles it on with `d`. It caches the last rendered diff content so tick-driven redraws skip re-colorization when the underlying diff has not changed — cheap on every render, noticeable at large diffs.

func NewDiffPane

func NewDiffPane() *DiffPane

NewDiffPane constructs a DiffPane with a zero-sized viewport; the caller must SetSize before the first render.

func (*DiffPane) GotoBottom

func (d *DiffPane) GotoBottom()

GotoBottom jumps the viewport to the end.

func (*DiffPane) GotoTop

func (d *DiffPane) GotoTop()

GotoTop jumps the viewport to the start.

func (*DiffPane) PageDown

func (d *DiffPane) PageDown()

PageDown scrolls the viewport down by half a view.

func (*DiffPane) PageUp

func (d *DiffPane) PageUp()

PageUp scrolls the viewport up by half a view.

func (*DiffPane) ScrollDown

func (d *DiffPane) ScrollDown()

ScrollDown scrolls the viewport down

func (*DiffPane) ScrollPercent

func (d *DiffPane) ScrollPercent() float64

ScrollPercent returns the viewport position as a fraction [0, 1].

func (*DiffPane) ScrollUp

func (d *DiffPane) ScrollUp()

ScrollUp scrolls the viewport up

func (*DiffPane) SetDiff

func (d *DiffPane) SetDiff(instance *core.InstanceView)

SetDiff replaces the rendered diff from instance's current diff stats. No-ops when the content has not changed since the last call, and shows fallback text for nil / unstarted / errored instances.

func (*DiffPane) SetSize

func (d *DiffPane) SetSize(width, height int)

SetSize resizes the embedded viewport and invalidates the cached colorized diff so the next SetDiff re-renders even when the underlying content is unchanged.

func (*DiffPane) String

func (d *DiffPane) String() string

type ErrBox

type ErrBox struct {
	// contains filtered or unexported fields
}

ErrBox is the bottom-row error surface. It renders a single-line, centered red message and collapses embedded newlines into `//` so multi-line errors still fit one row.

func NewErrBox

func NewErrBox() *ErrBox

NewErrBox constructs an empty ErrBox; the caller must SetSize before the first render.

func (*ErrBox) Clear

func (e *ErrBox) Clear()

Clear removes the currently displayed error and info line immediately.

func (*ErrBox) ExpireIfDue added in v0.13.0

func (e *ErrBox) ExpireIfDue(now time.Time)

ExpireIfDue clears the box once its armed deadline has passed. Intended to be called from an existing periodic tick rather than scheduling a timer per message — without this, SetInfo/SetError have no way to expire on their own and a toast lingers on screen indefinitely once shown.

func (*ErrBox) SetError

func (e *ErrBox) SetError(err error)

SetError replaces the currently displayed error and arms its auto-clear deadline (see ExpireIfDue). Pass nil to hide the box on the next render; prefer Clear for clarity.

func (*ErrBox) SetInfo added in v0.3.0

func (e *ErrBox) SetInfo(msg string)

SetInfo sets a non-error status line (e.g. the recovery summary) and arms its auto-clear deadline, mirroring SetError. An active error takes precedence over info in String().

func (*ErrBox) SetSize

func (e *ErrBox) SetSize(width, height int)

SetSize updates the rendering bounds.

func (*ErrBox) String

func (e *ErrBox) String() string

type GroupState added in v0.13.0

type GroupState int

GroupState classifies how an overview group renders.

const (
	GroupLoaded GroupState = iota // reconciled; render cards
	GroupEmpty                    // loaded but no instances
)

type InstanceSource added in v0.14.0

type InstanceSource interface {
	Rows() []core.InstanceView
}

InstanceSource supplies the rows a List shows, in display order. In production it is the slot's view store (app's slotRows: the workspace's views with the TUI's overlays), which the model's edits reach; the List only reads it, so adding, removing and replacing rows are edits of the source. Rows' IDs are unique; a draft row has ID 0.

type List

type List struct {
	// contains filtered or unexported fields
}

List is the left-panel session rail. It owns the selection cursor and viewport scroll offset, and delegates per-item rendering to RenderCard at DensityRail. The list does not spawn goroutines or mutate instances; its rows come from its InstanceSource, as core.InstanceView values.

func NewList

func NewList(spinner *spinner.Model, src InstanceSource) *List

NewList constructs a List showing src's rows, bound to the given spinner.

func (*List) Bottom

func (l *List) Bottom()

Bottom selects the last non-Deleting item.

func (*List) Down

func (l *List) Down()

Down selects the next non-Deleting item in the list. If every item below the cursor is Deleting (or the cursor is already on the last selectable item), selectedIdx stays put.

func (*List) GetInstanceByTitle added in v0.8.0

func (l *List) GetInstanceByTitle(title string) *core.InstanceView

GetInstanceByTitle returns a copy of the row with the given title, or nil.

func (*List) GetInstances

func (l *List) GetInstances() []core.InstanceView

GetInstances returns all rows in the list

func (*List) GetSelectedInstance

func (l *List) GetSelectedInstance() *core.InstanceView

GetSelectedInstance returns a copy of the currently selected row, or nil when there is none.

func (*List) NumInstances

func (l *List) NumInstances() int

NumInstances returns the number of instances currently held by the list. Used by GlobalInstanceLimit checks in the app layer before admitting a new instance.

func (*List) PageDown

func (l *List) PageDown()

PageDown jumps the selection down by one visible page, skipping Deleting items.

func (*List) PageUp

func (l *List) PageUp()

PageUp jumps the selection up by one visible page, skipping Deleting items. If every candidate in the target window is Deleting, the cursor stays put.

func (*List) PeerSections added in v0.13.0

func (l *List) PeerSections() []PeerSection

PeerSections returns the peer-workspace summaries currently set.

func (*List) SelectID added in v0.14.0

func (l *List) SelectID(id core.InstanceID)

SelectID finds and selects the row with the given ID in the list.

func (*List) SelectedIdx added in v0.13.0

func (l *List) SelectedIdx() int

SelectedIdx returns the current selection index (for jump helpers).

func (*List) SetPanes added in v0.14.0

func (l *List) SetPanes(panes *PaneClients)

SetPanes sets the registry the list reads its instances' attach clients from.

func (*List) SetPeerSections added in v0.13.0

func (l *List) SetPeerSections(peers []PeerSection)

SetPeerSections sets the peer-workspace summaries rendered under the rail.

func (*List) SetSelectedInstance

func (l *List) SetSelectedInstance(idx int)

SetSelectedInstance sets the selected index. Noop if the index is out of bounds.

func (*List) SetSessionPreviewSize

func (l *List) SetSessionPreviewSize(width, height int) (err error)

SetSessionPreviewSize sets the height and width for the tmux sessions. This makes the stdout line have the correct width and height. It sizes each started, unpaused row's client and probes no tmux session (it used to run a has-session per row): a row with no client has the zero Pane, whose SetPreviewSize does nothing.

func (*List) SetSize

func (l *List) SetSize(width, height int)

SetSize sets the height and width of the list.

func (*List) SetWorkspaceName

func (l *List) SetWorkspaceName(name string)

SetWorkspaceName sets the workspace name displayed in the title.

func (*List) Size added in v0.14.0

func (l *List) Size() (width, height int)

Size returns the width and height SetSize last set.

func (*List) String

func (l *List) String() string

func (*List) Top

func (l *List) Top()

Top selects the first non-Deleting item.

func (*List) Up

func (l *List) Up()

Up selects the prev non-Deleting item in the list. If every item above the cursor is Deleting, selectedIdx stays put.

func (*List) WorkspaceName added in v0.14.0

func (l *List) WorkspaceName() string

WorkspaceName returns the workspace name displayed in the title.

type MarkdownPane added in v0.13.0

type MarkdownPane struct {
	// contains filtered or unexported fields
}

MarkdownPane is the workbench's markdown viewer/editor: a glamour-rendered scrollable view with follow/pin semantics and a raw-text textarea edit mode. Not goroutine-safe; Update-goroutine only (renders lazily inside View, same discipline as ScrollModel.AdvanceAndRender).

func NewMarkdownPane added in v0.13.0

func NewMarkdownPane() *MarkdownPane

func (*MarkdownPane) ApplySaved added in v0.13.0

func (m *MarkdownPane) ApplySaved(raw string, mtime time.Time)

ApplySaved is called after a successful disk write: adopt the saved content as the new baseline and drop back to the rendered view.

func (*MarkdownPane) CancelEdit added in v0.13.0

func (m *MarkdownPane) CancelEdit()

func (*MarkdownPane) Clear added in v0.13.0

func (m *MarkdownPane) Clear()

Clear empties the pane (file deleted / no markdown in tree).

func (*MarkdownPane) EditDirty added in v0.13.0

func (m *MarkdownPane) EditDirty() bool

func (*MarkdownPane) EditValue added in v0.13.0

func (m *MarkdownPane) EditValue() string

func (*MarkdownPane) Editing added in v0.13.0

func (m *MarkdownPane) Editing() bool

func (*MarkdownPane) Following added in v0.13.0

func (m *MarkdownPane) Following() bool

func (*MarkdownPane) HandleEditKey added in v0.13.0

func (m *MarkdownPane) HandleEditKey(msg tea.KeyPressMsg)

HandleEditKey forwards a key to the textarea.

func (*MarkdownPane) Mtime added in v0.13.0

func (m *MarkdownPane) Mtime() time.Time

func (*MarkdownPane) PageDown added in v0.13.0

func (m *MarkdownPane) PageDown()

func (*MarkdownPane) PageUp added in v0.13.0

func (m *MarkdownPane) PageUp()

func (*MarkdownPane) Path added in v0.13.0

func (m *MarkdownPane) Path() string

func (*MarkdownPane) Scroll added in v0.13.0

func (m *MarkdownPane) Scroll() int

func (*MarkdownPane) ScrollBottom added in v0.13.0

func (m *MarkdownPane) ScrollBottom()

func (*MarkdownPane) ScrollDown added in v0.13.0

func (m *MarkdownPane) ScrollDown()

func (*MarkdownPane) ScrollTop added in v0.13.0

func (m *MarkdownPane) ScrollTop()

func (*MarkdownPane) ScrollUp added in v0.13.0

func (m *MarkdownPane) ScrollUp()

func (*MarkdownPane) SetDocument added in v0.13.0

func (m *MarkdownPane) SetDocument(path, raw string, mtime time.Time)

SetDocument replaces the shown document. A path change resets scroll; a same-path reload (follow refresh) preserves it, clamped.

func (*MarkdownPane) SetFollowing added in v0.13.0

func (m *MarkdownPane) SetFollowing(f bool)

func (*MarkdownPane) SetSize added in v0.13.0

func (m *MarkdownPane) SetSize(width, height int)

func (*MarkdownPane) StartEdit added in v0.13.0

func (m *MarkdownPane) StartEdit() bool

StartEdit flips to the raw-text editor seeded with the loaded content. Returns false when there is nothing to edit.

func (*MarkdownPane) View added in v0.13.0

func (m *MarkdownPane) View() string
type Menu struct {
	// contains filtered or unexported fields
}

Menu is the bottom-row keybinding hint strip. It reads GlobalkeyBindings to render labels and tracks the most recent keypress so the UI can momentarily underline the matching entry for visual feedback.

func NewMenu

func NewMenu() *Menu

NewMenu constructs a Menu in StateEmpty with no active keypress. The caller must SetSize before the first render.

func (m *Menu) ClearKeydown()

ClearKeydown removes any active key-press highlight.

func (m *Menu) Instance() *core.InstanceView

Instance returns the instance the menu was last pointed at (nil for none).

func (m *Menu) Keydown(name keys.KeyName)

Keydown marks name as the most recently pressed key so the next render underlines its menu entry. ClearKeydown resets this.

func (m *Menu) SetInstance(instance *core.InstanceView)

SetInstance updates the current instance and refreshes menu options. It keeps the copy it is given, so a change to the instance reaches the menu only through another SetInstance.

func (m *Menu) SetSize(width, height int)

SetSize sets the width of the window. The menu will be centered horizontally within this width.

func (m *Menu) SetState(state MenuState)

SetState updates the menu state and options accordingly

func (m *Menu) State() MenuState

State returns the menu's current state.

func (m *Menu) String() string
type MenuState int

MenuState represents different states the menu can be in

const (
	StateDefault MenuState = iota
	StateEmpty
	StateNewInstance
	StatePrompt
	StateQuickInteract
	StateInlineAttach
)

StateDefault through StateInlineAttach enumerate the menu's display modes. The active state selects which subset of keybindings the menu-bar shows and how they are grouped visually.

type Overview added in v0.13.0

type Overview struct {
	// contains filtered or unexported fields
}

Overview renders the triage card grid: every open workspace group's instances as bordered cards under a collapsible group header, with empty groups rendered inline. The render cursor spans groups (OverviewCursor{Group,Item}).

func NewOverview added in v0.13.0

func NewOverview() *Overview

NewOverview constructs an empty overview component.

func (*Overview) IsCollapsed added in v0.13.0

func (o *Overview) IsCollapsed(name string) bool

IsCollapsed reports a group's collapsed state.

func (*Overview) Render added in v0.13.0

func (o *Overview) Render(d OverviewData) string

Render draws the multi-group fleet overview. Height is hard-clamped; the combined vertical window (Task 7) keeps the cursor group/card visible.

func (*Overview) SetSize added in v0.13.0

func (o *Overview) SetSize(w, h int)

SetSize sets the render bounds.

func (*Overview) ToggleCollapse added in v0.13.0

func (o *Overview) ToggleCollapse(name string)

ToggleCollapse flips a group's collapsed state (case-insensitive name).

type OverviewCursor added in v0.13.0

type OverviewCursor struct {
	Group int
	Item  int
}

OverviewCursor is the render-space selection: a group index into Groups and an item position within that group's Order.

type OverviewData added in v0.13.0

type OverviewData struct {
	Groups  []OverviewGroup
	Cursor  OverviewCursor
	Spinner string
	// Panes resolves each card's attach client for its tail.
	Panes *PaneClients
}

OverviewData is everything Render needs, assembled by the app on the Update goroutine each frame (same pattern as List reading instances).

type OverviewGroup added in v0.13.0

type OverviewGroup struct {
	Name  string
	Items []core.InstanceView
	Order []int // SortForOverview(Items); empty when the group is empty
	State GroupState
}

OverviewGroup is one open workspace's slice of the overview.

type Pane added in v0.14.0

type Pane struct {
	// contains filtered or unexported fields
}

Pane is one agent pane's display surface. It covers its attach client's screen, scroll-back and cursor, input forwarded through the client's PTY, and the status scrape that reads the screen. The zero value has no client: the instance is not started, is paused, or has none attached yet. It answers every read with a zero value and every forward with nil, just as the instance's own guards did for an instance with no live pane.

func (Pane) Attached added in v0.14.0

func (p Pane) Attached() bool

Attached reports whether the pane's client is attached: its PTY is open and its pump still reads the session (tmux.TmuxSession.Attached). The health tick and the Dead path repair a live session's pane that is not.

func (Pane) CaptureHistory added in v0.14.0

func (p Pane) CaptureHistory() (string, bool)

CaptureHistory returns the pane's tmux buffer (scroll-back plus screen) for windowing on the snapshot path, or ("", false).

func (Pane) Client added in v0.14.0

func (p Pane) Client() *tmux.TmuxSession

Client returns the pane's attach client, or nil.

func (Pane) CursorState added in v0.14.0

func (p Pane) CursorState() (vt.Cursor, bool)

CursorState returns the pane's live cursor, or ok=false.

func (Pane) DetectStatus added in v0.14.0

func (p Pane) DetectStatus() (updated, hasPrompt bool, err error)

DetectStatus runs one status scan of the pane's screen (see tmux.TmuxSession.DetectStatus). Without a client there is no screen to scan and it returns zeros, which are no opinion, not "settled, no prompt": callers skip a pane whose Client is nil.

func (Pane) EmulatorScreen added in v0.14.0

func (p Pane) EmulatorScreen() (string, bool)

EmulatorScreen returns the emulator's visible screen without running a subprocess, which makes it cheap enough to call for every visible card each frame. ok is false without an emulator (snapshot path) or a client.

func (Pane) ForwardFocus added in v0.14.0

func (p Pane) ForwardFocus(in bool)

ForwardFocus forwards a focus in/out event when the agent has asked for them. It is best-effort: a failure is logged.

func (Pane) ForwardMouse added in v0.14.0

func (p Pane) ForwardMouse(cb, col, row int, press bool) error

ForwardMouse forwards one SGR mouse event at (col,row). Without a live session it does nothing.

func (Pane) ForwardWheel added in v0.14.0

func (p Pane) ForwardWheel(up bool, n int) error

ForwardWheel forwards n wheel events so a TUI agent scrolls its own view. Without a live session it does nothing.

func (Pane) GetContentHash added in v0.14.0

func (p Pane) GetContentHash() []byte

GetContentHash returns the hash of the screen that the last status scan saw.

func (Pane) HasEmulator added in v0.14.0

func (p Pane) HasEmulator() bool

HasEmulator reports whether the pane renders through the in-process emulator, the event-driven path.

func (Pane) IsAlternateScreen added in v0.14.0

func (p Pane) IsAlternateScreen() bool

IsAlternateScreen reports whether the agent is a full-screen TUI on the alternate screen. Such an agent's scroll-back must be forwarded as wheel events.

func (Pane) PaneTitle added in v0.14.0

func (p Pane) PaneTitle() (string, bool)

PaneTitle returns the window title the agent set via OSC, or ok=false.

func (Pane) Paste added in v0.14.0

func (p Pane) Paste(text string) error

Paste sends text as a bracketed paste. Without a live session it does nothing.

func (Pane) Preview added in v0.14.0

func (p Pane) Preview() (string, error)

Preview returns the pane's visible screen: the emulator's, or capture-pane's on the snapshot path. It is empty, with no error, when there is no live session.

func (Pane) SendKeysRaw added in v0.14.0

func (p Pane) SendKeysRaw(b []byte) error

SendKeysRaw writes raw key bytes through the client's PTY. Inline attach uses it.

func (Pane) SetPreviewSize added in v0.14.0

func (p Pane) SetPreviewSize(width, height int) error

SetPreviewSize resizes the pane's client, and with it the session's window. Without a client it does nothing; Ensure attaches at the default size.

type PaneClients added in v0.14.0

type PaneClients struct {
	// contains filtered or unexported fields
}

PaneClients holds the TUI's attach clients: one *tmux.TmuxSession per live agent tmux session, keyed by the session's name. Each client is attached by name rather than owned by the session's instance. Every pane render, scroll, cursor, mouse, paste and key forward goes through a client here (Pane), and so does the status scrape that reads a pane's screen. That is why session lifecycle never needs a client of its own.

Safe for concurrent use: Get and For may be called from Cmd goroutines. Ensure and Replace attach (a PTY spawn and a capture-pane), and they run on the Update goroutine as the attach paths before them did. A client that Replace or Retain hands back must be closed off the Update goroutine: PausePreview waits for the client's output pump, which blocks in tea.Program.Send until Update returns. Every method except the …ForTest helpers is nil-receiver safe; a nil registry holds no clients.

func NewPaneClients added in v0.14.0

func NewPaneClients() *PaneClients

NewPaneClients returns an empty registry whose clients attach through the production PTY factory and executor.

func (*PaneClients) Alive added in v0.14.0

func (p *PaneClients) Alive(sessionName string) bool

Alive reports whether sessionName has an attached client: its PTY is open and its pump still reads the session (tmux.TmuxSession.Attached).

func (*PaneClients) Ensure added in v0.14.0

func (p *PaneClients) Ensure(sessionName, program string) error

Ensure gives sessionName a client attached at the default size. If the session has no client, Ensure builds and attaches one. If its client is not attached (a failed attach, one paused for a full-screen attach, or one whose pump hit EOF when its session ended, even if a new session of the same name runs now), Ensure re-attaches it, the same object. Its Restore never waits on a live pump: a client whose PTY is gone has no pump left, and an exited pump marks itself only as it returns. An attached client is left alone, and so, for quickExitHoldoff after Ensure attached it, is one whose pump exited on its own: that attach failed at once, and the health tick retries it. program selects a new client's agent adapter for its status scan. The client stays registered even when attaching fails, so a later Ensure retries it. Update goroutine only.

func (*PaneClients) For added in v0.14.0

func (p *PaneClients) For(v *core.InstanceView) Pane

For returns v's pane: its session's client here, when v is started and not paused; otherwise the zero Pane (also for nil).

func (*PaneClients) Get added in v0.14.0

func (p *PaneClients) Get(sessionName string) *tmux.TmuxSession

Get returns sessionName's client, or nil.

func (*PaneClients) InjectForTest added in v0.14.0

func (p *PaneClients) InjectForTest(sessionName string, c *tmux.TmuxSession)

InjectForTest registers c as sessionName's client, as Ensure would have. Test-only, like SetClientFactoryForTest.

func (*PaneClients) Replace added in v0.14.0

func (p *PaneClients) Replace(sessionName, program string) (*tmux.TmuxSession, error)

Replace gives sessionName a fresh client. It is for a session just (re)launched under that name, whose previous client was watching the session it replaced. The old client, if any, is returned for the caller to close off the Update goroutine. Update goroutine only.

func (*PaneClients) Retain added in v0.14.0

func (p *PaneClients) Retain(keep map[string]bool) []*tmux.TmuxSession

Retain drops every client whose session name is not in keep and returns them for the caller to close off the Update goroutine.

func (*PaneClients) SetClientFactoryForTest added in v0.14.0

func (p *PaneClients) SetClientFactoryForTest(f func(sessionName, program string) *tmux.TmuxSession)

SetClientFactoryForTest replaces how new clients are built, so that a test's Ensure/Replace attach through a fake PTY. Test-only: the name and doc comment are guardrails; nothing about the method enforces test-only use.

func (*PaneClients) SetClockForTest added in v0.14.0

func (p *PaneClients) SetClockForTest(now func() time.Time)

SetClockForTest replaces the clock Ensure times attaches by, so a test can step past quickExitHoldoff without sleeping. Test-only, like SetClientFactoryForTest.

func (*PaneClients) SetDefaultSize added in v0.14.0

func (p *PaneClients) SetDefaultSize(cols, rows int)

SetDefaultSize records the agent pane size that clients attach at.

type PeerSection added in v0.13.0

type PeerSection struct {
	Name      string
	Attention int // Prompting or bell-pending
	Running   int // Running/Loading
	Idle      int // everything else
}

PeerSection summarizes a non-focused workspace slot for the rail footer (live counts from that slot's list; selection stays scoped to the focused workspace until cross-workspace lands).

type PreviewPane

type PreviewPane struct {
	// contains filtered or unexported fields
}

PreviewPane renders the agent tmux pane's content in the top half of the split view. It tails the emulator's live screen at the live tail, and when scrolled windows the emulator's scrollback in-process (ScrollModel); on the no-emulator path (snapshot mode / Windows) it paints a window into tmux's authoritative history (capture-pane -S -) via snapFallback. Either way live output keeps flowing. lastInstanceTitle resets the scroll position on selection change rather than persisting a stale offset.

func NewPreviewPane

func NewPreviewPane() *PreviewPane

NewPreviewPane constructs a PreviewPane at live tail; the caller must SetSize before the first render.

func (*PreviewPane) BeginSelection added in v0.3.0

func (p *PreviewPane) BeginSelection(row, col int)

BeginSelection starts a selection anchored at content (row, col).

func (*PreviewPane) ClearSelection added in v0.3.0

func (p *PreviewPane) ClearSelection()

ClearSelection clears any active selection.

func (*PreviewPane) ExtendSelection added in v0.3.0

func (p *PreviewPane) ExtendSelection(row, col int)

ExtendSelection moves the active selection's cursor to content (row, col).

func (*PreviewPane) GotoBottom

func (p *PreviewPane) GotoBottom(instance *core.InstanceView) error

GotoBottom returns to the live tail (TUI: a large wheel-down burst).

func (*PreviewPane) GotoTop

func (p *PreviewPane) GotoTop(instance *core.InstanceView) error

GotoTop jumps to the oldest line of captured history (TUI: a large wheel-up burst).

func (*PreviewPane) IsScrolling

func (p *PreviewPane) IsScrolling() bool

IsScrolling reports whether the pane is scrolled away from the live tail.

func (*PreviewPane) PageDown

func (p *PreviewPane) PageDown(instance *core.InstanceView) error

PageDown scrolls down by half a pane height (or forwards a burst of wheel-downs).

func (*PreviewPane) PageUp

func (p *PreviewPane) PageUp(instance *core.InstanceView) error

PageUp scrolls up by half a pane height (or forwards a burst of wheel-ups).

func (*PreviewPane) ResetToNormalMode

func (p *PreviewPane) ResetToNormalMode(instance *core.InstanceView) error

ResetToNormalMode returns the pane to the live tail on both paths.

func (*PreviewPane) ScrollDown

func (p *PreviewPane) ScrollDown(instance *core.InstanceView) error

ScrollDown scrolls one line down toward the live tail (or forwards a damped wheel-down).

func (*PreviewPane) ScrollPercent

func (p *PreviewPane) ScrollPercent() float64

ScrollPercent returns the scroll position as a fraction [0, 1]; 1.0 == live tail (bottom).

func (*PreviewPane) ScrollUp

func (p *PreviewPane) ScrollUp(instance *core.InstanceView) error

ScrollUp scrolls one line up into history (or forwards a damped wheel-up to a TUI agent).

func (*PreviewPane) SelectedText added in v0.3.0

func (p *PreviewPane) SelectedText() string

SelectedText returns the currently selected text (plain), or "" if none.

func (*PreviewPane) SetPanes added in v0.14.0

func (p *PreviewPane) SetPanes(panes *PaneClients)

SetPanes sets the registry the pane reads its instance's attach client from.

func (*PreviewPane) SetSize

func (p *PreviewPane) SetSize(width, maxHeight int)

SetSize records the pane dimensions. maxHeight caps the visible height — content exceeding it is truncated with an ellipsis at live tail or windowed when scrolled.

func (*PreviewPane) ShowingFallback added in v0.8.0

func (p *PreviewPane) ShowingFallback() bool

ShowingFallback reports whether the pane is displaying splash/fallback text instead of live terminal content (no cursor applies there).

func (*PreviewPane) String

func (p *PreviewPane) String() string

Returns the preview pane content as a string.

func (*PreviewPane) UpdateContent

func (p *PreviewPane) UpdateContent(instance *core.InstanceView) error

UpdateContent refreshes the pane from the given instance. At the live tail it tails the live emulator screen; when scrolled it windows the emulator's scrollback in-process (ScrollModel), or, on the no-emulator path, tmux's authoritative history (capture-pane -S -) at the current offset, anchoring the view to its content as live output accrues below. Falls back to splash text for nil/loading/paused instances and resets the offset on instance change.

type QuickInputAction

type QuickInputAction int

QuickInputAction represents the result of handling a key press in the input bar.

const (
	QuickInputContinue QuickInputAction = iota
	QuickInputSubmit
	QuickInputCancel
)

QuickInputContinue, QuickInputSubmit, and QuickInputCancel are the terminal states HandleKey returns so the parent model knows whether to keep the bar open, dispatch the contents, or dismiss the bar.

type QuickInputBar

type QuickInputBar struct {
	Target QuickInputTarget
	// contains filtered or unexported fields
}

QuickInputBar is a single-line input bar for quick interactions with tmux sessions.

func NewQuickInputBar

func NewQuickInputBar(target QuickInputTarget) *QuickInputBar

NewQuickInputBar creates a focused input bar ready for typing.

func (*QuickInputBar) HandleKeyPress

func (q *QuickInputBar) HandleKeyPress(msg tea.KeyPressMsg) QuickInputAction

HandleKeyPress processes a key event and returns the resulting action.

func (*QuickInputBar) Height

func (q *QuickInputBar) Height() int

Height returns the number of lines the input bar occupies.

func (*QuickInputBar) SetWidth

func (q *QuickInputBar) SetWidth(w int)

SetWidth sets the rendering width of the input bar.

func (*QuickInputBar) Value

func (q *QuickInputBar) Value() string

Value returns the current text in the input bar.

func (*QuickInputBar) View

func (q *QuickInputBar) View() string

View renders the input bar.

type QuickInputTarget

type QuickInputTarget int

QuickInputTarget specifies where submitted text should be routed.

const (
	QuickInputTargetAgent QuickInputTarget = iota
	QuickInputTargetTerminal
)

QuickInputTargetAgent sends submitted text to the agent pane; the terminal variant routes to the bottom pane. The target is chosen at construction time and is immutable for the life of the bar.

type ReviewPane added in v0.13.0

type ReviewPane interface {
	SetSize(width, height int)
	View() string
}

ReviewPane is the workbench's view of the review panel. The concrete *reviewui.Pane lives in the app layer: ui/review imports ui for theme roles, so package ui must not import it back.

type ScrollModel added in v0.13.0

type ScrollModel struct {
	// contains filtered or unexported fields
}

ScrollModel owns pane scroll state for the emulator path: the lines-from-bottom offset, output anchoring, the new-lines-below footer count, wheel damping, and alt-screen routing. Both panes embed one. All methods run on the Update goroutine (no locking; TerminalPane's own mutex wraps its calls).

func (*ScrollModel) AdvanceAndRender added in v0.13.0

func (m *ScrollModel) AdvanceAndRender(src scrollSource, rows int) (window string, live bool, ok bool)

AdvanceAndRender renders `rows` lines at the current offset. live=true means the pane is at the live tail (offset 0) and the caller should render its normal live view instead. ok=false means no emulator (snapshot fallback).

It also performs the per-render anchoring bump and clamping (hence the name — it advances the anchor state AND renders), so it must be called exactly once per render pass. A repeat call with no intervening output is idempotent: sbLen is unchanged so the anchor bump is a no-op and the window is identical. The only failure mode of an extra call is NewLinesBelow drift if output *did* arrive between the two calls — never corruption of the rendered window.

Limitation: at the emulator's scrollback cap (x/vt default 10k lines) sbLen plateaus, so the anchor bump stops compensating for further scroll-off and the view drifts up by at most the overflow. Bounded, graceful degradation — accepted.

func (*ScrollModel) GotoTop added in v0.13.0

func (m *ScrollModel) GotoTop(src scrollSource)

GotoTop pins the view to the oldest line (clamped in Window).

func (*ScrollModel) IsScrolling added in v0.13.0

func (m *ScrollModel) IsScrolling() bool

IsScrolling reports whether the pane is away from the live tail.

func (*ScrollModel) NeedsAltProbe added in v0.13.0

func (m *ScrollModel) NeedsAltProbe() bool

NeedsAltProbe reports whether the alt-screen TTL cache is stale, i.e. the next isAltScreen would run a subprocess probe. It only reads cache timestamps, so a caller holding its own mutex can consult it, drop the mutex, run the probe (IsAlternateScreen — a tmux subprocess) off-lock, then SetAltProbe the result before invoking a routing method. That keeps the subprocess out of the caller's lock while a subsequent route()/PageUp on the now-fresh cache never re-probes. Used by TerminalPane, whose t.mu wraps all ScrollModel access; PreviewPane is unlocked and calls the routers directly.

func (*ScrollModel) NewLinesBelow added in v0.13.0

func (m *ScrollModel) NewLinesBelow() int

NewLinesBelow is the footer count: scroll-off lines accrued since the gesture began. Limitation: at the scrollback cap (x/vt default 10k lines) sbLen plateaus, so the count stops growing even as new output arrives — bounded, graceful degradation, accepted.

func (*ScrollModel) PageDown added in v0.13.0

func (m *ScrollModel) PageDown(src scrollSource, height int) error

func (*ScrollModel) PageUp added in v0.13.0

func (m *ScrollModel) PageUp(src scrollSource, height int) error

PageUp/PageDown move by half the given pane height (or forward a burst).

func (*ScrollModel) Reset added in v0.13.0

func (m *ScrollModel) Reset()

Reset returns to the live tail (resize, instance switch, Esc/End) and forces the next alt-screen probe.

func (*ScrollModel) ScrollBy added in v0.13.0

func (m *ScrollModel) ScrollBy(src scrollSource, delta int)

ScrollBy moves the offset by delta (positive = up into history). The gesture baseline is captured on the first move away from the tail.

func (*ScrollModel) ScrollDown added in v0.13.0

func (m *ScrollModel) ScrollDown(src scrollSource) error

func (*ScrollModel) ScrollPercent added in v0.13.0

func (m *ScrollModel) ScrollPercent(src scrollSource) float64

ScrollPercent maps the offset to [0,1]; 1.0 = live tail.

func (*ScrollModel) ScrollUp added in v0.13.0

func (m *ScrollModel) ScrollUp(src scrollSource) error

ScrollUp/ScrollDown route one wheel/key tick: alt-screen TUIs get damped forwarded wheel events; everything else moves the window.

func (*ScrollModel) SetAltProbe added in v0.13.0

func (m *ScrollModel) SetAltProbe(alt bool)

SetAltProbe stores a freshly-probed alt-screen result and stamps the TTL, so the next isAltScreen within agentScrollTTL is a cache hit. Pairs with NeedsAltProbe for off-lock probing (see there).

type SplitPane

type SplitPane struct {
	// contains filtered or unexported fields
}

SplitPane composes the right-hand side of the TUI: an agent preview on top, a terminal pane below (split by the adjustable agentRatio, default SplitAgentPercent; the terminal pane can be hidden entirely), and a hotkey-toggled diff overlay that replaces both. SplitPane holds the currently-focused pane index and inline-attach flag but does not own scroll state — each child pane manages its own viewport.

func NewSplitPane

func NewSplitPane(agent *PreviewPane, diff *DiffPane, terminal *TerminalPane) *SplitPane

NewSplitPane wires the three child panes into a SplitPane with the agent pane focused by default. The caller retains ownership of the child panes; SplitPane borrows them for routing.

func (*SplitPane) AdjustAgentRatio added in v0.13.0

func (s *SplitPane) AdjustAgentRatio(delta float64) float64

AdjustAgentRatio nudges the split by delta and returns the new ratio.

func (*SplitPane) AgentContentHeight added in v0.13.0

func (s *SplitPane) AgentContentHeight() int

AgentContentHeight is the agent pane's inner height — the app's mouse hit-test anchor mirrors layout through this instead of duplicating the math.

func (*SplitPane) AgentRatio added in v0.13.0

func (s *SplitPane) AgentRatio() float64

AgentRatio returns the agent pane's height share (default SplitAgentPercent when unset).

func (*SplitPane) BeginSelection added in v0.3.0

func (s *SplitPane) BeginSelection(pane, row, col int)

BeginSelection starts a selection on the given content pane (clearing any selection on the other pane first).

func (*SplitPane) ClearSelections added in v0.3.0

func (s *SplitPane) ClearSelections()

ClearSelections clears the selection on both content panes.

func (*SplitPane) CurrentTerminalSessionName added in v0.8.0

func (s *SplitPane) CurrentTerminalSessionName() string

CurrentTerminalSessionName returns the tmux session name backing the currently displayed terminal pane, or "" if none — the key pane events are routed by.

func (*SplitPane) CursorScreenPosition added in v0.8.0

func (s *SplitPane) CursorScreenPosition(instance *core.InstanceView) (x, y int, cur vt.Cursor, ok bool)

CursorScreenPosition returns the focused pane's live cursor as split-local coordinates plus its full state, or ok=false whenever no hardware cursor should be shown: diff overlay up, focused pane scrolled off the live tail or showing fallback text, no emulator-backed session, cursor hidden (DECTCEM), or the cell out of the pane's bounds.

func (*SplitPane) ExtendSelection added in v0.3.0

func (s *SplitPane) ExtendSelection(pane, row, col int)

ExtendSelection moves the active selection's cursor on the given content pane.

func (*SplitPane) ForwardTerminalFocus added in v0.8.0

func (s *SplitPane) ForwardTerminalFocus(in bool)

ForwardTerminalFocus forwards a focus event to the terminal pane's session.

func (*SplitPane) ForwardTerminalMouse added in v0.3.0

func (s *SplitPane) ForwardTerminalMouse(cb, col, row int, press bool) error

ForwardTerminalMouse forwards one SGR mouse event to the terminal pane's session.

func (*SplitPane) GetAgentSize

func (s *SplitPane) GetAgentSize() (width, height int)

GetAgentSize returns the current width and height of the agent pane, primarily used by the attach flow to size the PTY before handing it to the user.

func (*SplitPane) GetFocusedPane

func (s *SplitPane) GetFocusedPane() int

GetFocusedPane returns the currently focused pane constant.

func (*SplitPane) GotoBottom

func (s *SplitPane) GotoBottom()

GotoBottom jumps the active pane to the live tail, exiting scroll mode.

func (*SplitPane) GotoTop

func (s *SplitPane) GotoTop()

GotoTop jumps the active pane to the start of its scrollback.

func (*SplitPane) HitTest added in v0.3.0

func (s *SplitPane) HitTest(localX, y int) (pane, row, col int, ok bool)

HitTest maps split-pane-local coordinates (x relative to the split's left edge, y from the top of the split) to a content pane and (row, col) within it. Returns ok=false for the diff overlay, borders, the title/bottom-border rows, or coordinates outside any content area. The returned pane is FocusAgent or FocusTerminal. Geometry mirrors renderPane: each box is a title row, a body bordered left/right/bottom (no top), stacked agent-over-terminal.

func (*SplitPane) InjectTerminalSessionForTest added in v0.6.0

func (s *SplitPane) InjectTerminalSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)

InjectTerminalSessionForTest installs ts as the cached terminal session for the given instance title, bypassing the terminal pane's normal lazy-spawn path. Test-only: the name and doc comment are guardrails, nothing about the method enforces test-only use.

func (*SplitPane) Instance added in v0.13.0

func (s *SplitPane) Instance() *core.InstanceView

Instance returns the instance set by SetInstance (nil for none).

func (*SplitPane) IsAgentInScrollMode

func (s *SplitPane) IsAgentInScrollMode() bool

IsAgentInScrollMode returns true if the agent pane is scrolled away from the live tail.

func (*SplitPane) IsDiffVisible

func (s *SplitPane) IsDiffVisible() bool

IsDiffVisible returns true if the diff overlay is currently shown.

func (*SplitPane) IsTerminalHidden added in v0.13.0

func (s *SplitPane) IsTerminalHidden() bool

IsTerminalHidden reports whether the terminal pane is hidden.

func (*SplitPane) IsTerminalInScrollMode

func (s *SplitPane) IsTerminalInScrollMode() bool

IsTerminalInScrollMode returns true if the terminal pane is in scroll mode.

func (*SplitPane) PageDown

func (s *SplitPane) PageDown()

PageDown scrolls the active pane down by half a view.

func (*SplitPane) PageTerminalDown

func (s *SplitPane) PageTerminalDown()

PageTerminalDown pages the terminal pane explicitly.

func (*SplitPane) PageTerminalUp

func (s *SplitPane) PageTerminalUp()

PageTerminalUp pages the terminal pane explicitly.

func (*SplitPane) PageUp

func (s *SplitPane) PageUp()

PageUp scrolls the active pane (diff if visible, else focused) up by half a view.

func (*SplitPane) PasteTerminal added in v0.3.0

func (s *SplitPane) PasteTerminal(text string) error

PasteTerminal sends text to the terminal pane's session as a bracketed paste.

func (*SplitPane) ResetAgentToNormalMode

func (s *SplitPane) ResetAgentToNormalMode(instance *core.InstanceView) error

ResetAgentToNormalMode resets the agent pane to normal mode.

func (*SplitPane) ResetTerminalToNormalMode

func (s *SplitPane) ResetTerminalToNormalMode()

ResetTerminalToNormalMode exits scroll mode on the terminal pane.

func (*SplitPane) ScrollAgentDown

func (s *SplitPane) ScrollAgentDown()

ScrollAgentDown scrolls the agent pane explicitly (mouse wheel).

func (*SplitPane) ScrollAgentUp

func (s *SplitPane) ScrollAgentUp()

ScrollAgentUp scrolls the agent pane explicitly, ignoring focus/diff (mouse wheel).

The explicit scrollers re-render their pane themselves: a scroll only moves the ScrollModel offset, and the displayed text is rebuilt by UpdateContent. The keyboard path gets that refresh for free from handleScriptDone → instanceChanged, but the wheel handler calls nothing else, so without this the pane sat frozen at the old window until the agent's next output event (or a stray keypress) happened to redraw it.

func (*SplitPane) ScrollDiffDown

func (s *SplitPane) ScrollDiffDown()

ScrollDiffDown scrolls the diff overlay explicitly (no-op if not visible).

func (*SplitPane) ScrollDiffUp

func (s *SplitPane) ScrollDiffUp()

ScrollDiffUp scrolls the diff overlay explicitly (no-op if not visible).

func (*SplitPane) ScrollDown

func (s *SplitPane) ScrollDown()

ScrollDown is the counterpart of ScrollUp; see ScrollUp for routing and error-handling rules.

func (*SplitPane) ScrollTerminalDown

func (s *SplitPane) ScrollTerminalDown()

ScrollTerminalDown scrolls the terminal pane explicitly (mouse wheel).

func (*SplitPane) ScrollTerminalUp

func (s *SplitPane) ScrollTerminalUp()

ScrollTerminalUp scrolls the terminal pane explicitly (mouse wheel). Re-renders for the same reason as ScrollAgentUp.

func (*SplitPane) ScrollUp

func (s *SplitPane) ScrollUp()

ScrollUp scrolls the active pane up by one line. Routing order: diff overlay (when visible) beats the focused pane. Scroll errors are logged rather than propagated because scroll is a view-only operation and should not abort the caller's update cycle.

func (*SplitPane) SelectedText added in v0.3.0

func (s *SplitPane) SelectedText(pane int) string

SelectedText returns the selected text of the given content pane.

func (*SplitPane) SendTerminalKeysRaw

func (s *SplitPane) SendTerminalKeysRaw(b []byte) error

SendTerminalKeysRaw writes raw bytes to the terminal pane's tmux PTY.

func (*SplitPane) SendTerminalKeysToInstance added in v0.1.2

func (s *SplitPane) SendTerminalKeysToInstance(title, text string) error

SendTerminalKeysToInstance sends text followed by Enter to the named instance's cached terminal session. Unlike SendTerminalPrompt, this does not require the instance to be currently displayed.

func (*SplitPane) SendTerminalPrompt

func (s *SplitPane) SendTerminalPrompt(text string) error

SendTerminalPrompt sends text followed by Enter to the terminal pane's tmux session.

func (*SplitPane) SetAgentRatio added in v0.13.0

func (s *SplitPane) SetAgentRatio(r float64)

SetAgentRatio sets the agent share (clamped to [0.2, 0.9]) and re-lays-out at the current size. The ratio is snapped to two decimals so repeated ±delta nudges don't accumulate float drift (0.7+0.1 = 0.7999… would truncate a row short in SetSize).

func (*SplitPane) SetFocusedPane

func (s *SplitPane) SetFocusedPane(pane int)

SetFocusedPane sets focus to the specified pane.

func (*SplitPane) SetInlineAttach

func (s *SplitPane) SetInlineAttach(attached bool)

SetInlineAttach toggles whether inline-attach mode is active, controlling whether the focused-pane highlight is rendered.

func (*SplitPane) SetInstance

func (s *SplitPane) SetInstance(instance *core.InstanceView)

SetInstance sets the instance whose state the child panes will render on the next UpdateAgent/UpdateDiff/UpdateTerminal call. The child panes read their content from the instance, so switching here without calling the Update* methods leaves the previously-rendered content in place until the next tick. The pane keeps the copy it is given: a change to the instance reaches it (the agent pane's title, the scroll paths) only through another SetInstance.

func (*SplitPane) SetPanes added in v0.14.0

func (s *SplitPane) SetPanes(panes *PaneClients)

SetPanes sets the registry the agent pane and the hardware cursor read attach clients from.

func (*SplitPane) SetSize

func (s *SplitPane) SetSize(width, height int)

SetSize recomputes the agent/terminal split (per AgentRatio, or all agent when the terminal is hidden) for the given container dimensions and propagates widths to every child pane, including the diff overlay which uses the full inner height.

func (*SplitPane) SetTerminalHidden added in v0.13.0

func (s *SplitPane) SetTerminalHidden(h bool)

SetTerminalHidden shows/hides the terminal pane; hidden gives the agent pane the full height.

func (*SplitPane) String

func (s *SplitPane) String() string

func (*SplitPane) Terminal added in v0.13.0

func (s *SplitPane) Terminal() *TerminalPane

Terminal exposes the terminal child pane so workbench mode can render/size the same TerminalPane instance in its right panel. Ordering contract: in workbench mode the app calls SplitPane.SetSize (which, with the terminal hidden, sizes it to zero) BEFORE Workbench.SetSize re-sizes it for the panel — keep that order.

func (*SplitPane) TerminalTmuxSession

func (s *SplitPane) TerminalTmuxSession() *tmux.TmuxSession

TerminalTmuxSession returns the live tmux session backing the currently displayed terminal pane, or nil if none exists. Callers use this to drive a full-screen attach via tea.ExecProcess.

func (*SplitPane) ToggleDiff

func (s *SplitPane) ToggleDiff()

ToggleDiff shows or hides the diff overlay.

func (*SplitPane) UpdateAgent

func (s *SplitPane) UpdateAgent(instance *core.InstanceView) error

UpdateAgent updates the agent (preview) pane content. Always updates since it's always visible.

func (*SplitPane) UpdateDiff

func (s *SplitPane) UpdateDiff(instance *core.InstanceView)

UpdateDiff updates the diff pane content. Only updates when the overlay is visible.

func (*SplitPane) UpdateTerminal

func (s *SplitPane) UpdateTerminal(instance *core.InstanceView) error

UpdateTerminal updates the terminal pane content. It intentionally keeps updating while the pane is hidden so the content stays warm for an instant unhide.

type SubagentRow added in v0.13.0

type SubagentRow struct {
	Name        string
	Description string
	Idle        bool
}

SubagentRow is one live subagent or teammate shown on a card.

type TabStatus

type TabStatus int

TabStatus represents the highest-priority instance status within a workspace tab. Precedence (high→low): Prompting > Running > Ready > Loading > Paused > None.

const (
	TabStatusNone TabStatus = iota
	TabStatusPaused
	TabStatusLoading
	TabStatusReady
	TabStatusRunning
	TabStatusPrompting
)

TabStatusNone through TabStatusPrompting rank an instance status by display priority. A tab aggregates statuses by taking the max across its instances so the most urgent one shows through in the tab dot.

type TerminalPane

type TerminalPane struct {
	// contains filtered or unexported fields
}

TerminalPane manages shell tmux sessions in the worktree directory of selected instances. Sessions are cached per instance so switching between instances preserves terminal state.

func NewTerminalPane

func NewTerminalPane() *TerminalPane

NewTerminalPane constructs a TerminalPane with an empty session cache at the live tail. The caller must SetSize before the first render and feed instances via UpdateContent.

func (*TerminalPane) BeginSelection added in v0.3.0

func (t *TerminalPane) BeginSelection(row, col int)

BeginSelection starts a selection anchored at content (row, col).

func (*TerminalPane) ClearSelection added in v0.3.0

func (t *TerminalPane) ClearSelection()

ClearSelection clears any active selection.

func (*TerminalPane) Close

func (t *TerminalPane) Close()

Close kills all cached terminal tmux sessions and cleans up.

func (*TerminalPane) CurrentTmuxSession

func (t *TerminalPane) CurrentTmuxSession() *tmux.TmuxSession

CurrentTmuxSession returns the cached tmux session for the currently displayed instance, or nil if none exists or the session is dead. Intended for callers that drive full-screen attach via tea.ExecProcess.

func (*TerminalPane) CursorState added in v0.8.0

func (t *TerminalPane) CursorState() (vt.Cursor, bool)

CursorState returns the current terminal session's live cursor state, or ok=false when no live emulator-backed session is displayed.

func (*TerminalPane) DetachAll added in v0.13.0

func (t *TerminalPane) DetachAll() []*tmux.TmuxSession

DetachAll empties the session cache and returns the cached tmux sessions, for a caller dropping this pane to release their attach clients (PausePreview) off the Update goroutine. Unlike Close, nothing is killed: the shells keep running for the next pane that shows them. Pure bookkeeping — no blocking I/O — so it is safe to call from Update.

func (*TerminalPane) DetachExcept added in v0.13.0

func (t *TerminalPane) DetachExcept(keep map[string]bool) []*tmux.TmuxSession

DetachExcept is DetachAll for the cache entries whose instance titles are not in keep: a pane that stays in use hands over only the sessions its new owner can't show.

func (*TerminalPane) ExtendSelection added in v0.3.0

func (t *TerminalPane) ExtendSelection(row, col int)

ExtendSelection moves the active selection's cursor to content (row, col).

func (*TerminalPane) ForwardFocus added in v0.8.0

func (t *TerminalPane) ForwardFocus(in bool)

ForwardFocus forwards a host focus in/out event to the current terminal session, gated on mode 1004. Best-effort.

func (*TerminalPane) ForwardMouse added in v0.3.0

func (t *TerminalPane) ForwardMouse(cb, col, row int, press bool) error

ForwardMouse forwards one SGR mouse event to the current terminal session.

func (*TerminalPane) GotoBottom

func (t *TerminalPane) GotoBottom()

GotoBottom returns to the live tail on both paths.

func (*TerminalPane) GotoTop

func (t *TerminalPane) GotoTop() error

GotoTop jumps to the oldest line of history (TUI: a large wheel-up burst).

func (*TerminalPane) InjectSessionForTest added in v0.6.0

func (t *TerminalPane) InjectSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)

InjectSessionForTest installs ts as the cached terminal session for the given instance title, bypassing ensureSessionLocked's normal lazy-spawn path so a test can pin a specific (possibly dead) session in place. Test-only: the name and doc comment are guardrails, nothing about the method enforces test-only use.

func (*TerminalPane) IsScrolling

func (t *TerminalPane) IsScrolling() bool

IsScrolling reports whether the pane is scrolled away from the live tail.

func (*TerminalPane) PageDown

func (t *TerminalPane) PageDown() error

PageDown scrolls down by half a pane height (or forwards a burst of wheel-downs).

func (*TerminalPane) PageUp

func (t *TerminalPane) PageUp() error

PageUp scrolls up by half a pane height (or forwards a burst of wheel-ups).

func (*TerminalPane) Paste added in v0.3.0

func (t *TerminalPane) Paste(text string) error

Paste sends text to the current terminal session as a bracketed paste.

func (*TerminalPane) ResetToNormalMode

func (t *TerminalPane) ResetToNormalMode()

ResetToNormalMode returns the pane to the live tail on both paths.

func (*TerminalPane) ScrollDown

func (t *TerminalPane) ScrollDown() error

ScrollDown scrolls one line down toward the live tail (or forwards a damped wheel-down to a TUI agent).

func (*TerminalPane) ScrollPercent

func (t *TerminalPane) ScrollPercent() float64

ScrollPercent returns the scroll position as a fraction [0, 1]; 1.0 == live tail (bottom).

func (*TerminalPane) ScrollUp

func (t *TerminalPane) ScrollUp() error

ScrollUp scrolls one line up into history (or forwards a damped wheel-up to a TUI agent on the alternate screen).

func (*TerminalPane) SelectedText added in v0.3.0

func (t *TerminalPane) SelectedText() string

SelectedText returns the currently selected text (plain), or "" if none.

func (*TerminalPane) SendKeysRaw

func (t *TerminalPane) SendKeysRaw(b []byte) error

SendKeysRaw writes raw bytes to the current terminal tmux PTY.

func (*TerminalPane) SendKeysToInstance added in v0.1.2

func (t *TerminalPane) SendKeysToInstance(title, text string) error

SendKeysToInstance sends text followed by Enter to the cached terminal session for the named instance, regardless of which instance is currently displayed. Returns an error if no session is cached for that title or the session has died — callers (typically scripts) should surface the error rather than silently no-op'ing so the user knows the keystroke didn't land.

func (*TerminalPane) SendPrompt

func (t *TerminalPane) SendPrompt(text string) error

SendPrompt sends text followed by Enter to the current terminal session.

func (*TerminalPane) SetSize

func (t *TerminalPane) SetSize(width, height int)

SetSize resizes the pane under the internal mutex. The internal tmux session owned by TerminalPane is resized lazily on the next tick so this call remains cheap.

func (*TerminalPane) ShowingFallback added in v0.8.0

func (t *TerminalPane) ShowingFallback() bool

ShowingFallback reports whether the pane is displaying fallback text instead of live terminal content (no cursor applies there).

func (*TerminalPane) String

func (t *TerminalPane) String() string

func (*TerminalPane) UpdateContent

func (t *TerminalPane) UpdateContent(instance *core.InstanceView) error

UpdateContent captures the terminal pane output. At the live tail it tails the live emulator screen (capture-pane fallback when no emulator); when scrolled it windows the emulator's scrollback in-process (ScrollModel), or, on the no-emulator path, tmux's authoritative history at the current offset.

type Theme added in v0.13.0

type Theme struct {
	Name string

	// Surfaces and text.
	Ground color.Color // full-bleed background (reserved; no style paints it yet)
	Panel  color.Color // raised-surface background (workspace-terminal rows, selected cards)
	Text   color.Color // primary foreground
	Dim    color.Color // secondary labels, hints
	Faint  color.Color // barely-there text (aux hints, disabled)
	Rule   color.Color // unfocused borders, separators

	// Accents. Attention is reserved for "an agent needs the user" —
	// nothing else may use it, so a calm screen has no loud color.
	Accent    color.Color // focus, activity, selected borders
	Attention color.Color // needs-input / bell — the ONLY loud color
	Highlight color.Color // key glyphs, scroll footers
	OK        color.Color // ready status, added lines
	Error     color.Color // errors, removed lines, destructive accents
	Workspace color.Color // workspace labels, workspace-terminal identity
	Info      color.Color // informational text, hunk headers, running tabs

	// Selection (list rows, pickers).
	SelectionBg color.Color
	SelectionFg color.Color
}

Theme is a named palette of semantic color roles. Components never reference literal colors — they reference the package-level role vars below, which ApplyTheme reassigns. Styles built from roles at package init would capture stale values, so any package-level lipgloss.Style derived from a role must be (re)built inside a RegisterThemeHook callback (see rebuildListStyles in list.go for the pattern).

type Workbench added in v0.13.0

type Workbench struct {
	Markdown *MarkdownPane
	// contains filtered or unexported fields
}

Workbench renders the right panel of workbench mode: a tab strip over one of markdown / diff / files / terminal. It owns its MarkdownPane and DiffPane; the TerminalPane is the session's shared pane (see SplitPane.Terminal for the sizing-order contract).

func NewWorkbench added in v0.13.0

func NewWorkbench(diff *DiffPane, terminal *TerminalPane) *Workbench

func (*Workbench) Diff added in v0.13.0

func (w *Workbench) Diff() *DiffPane

func (*Workbench) FileUnderCursor added in v0.13.0

func (w *Workbench) FileUnderCursor() (string, bool)

FileUnderCursor resolves the cursor to an absolute path.

func (*Workbench) FilesBottom added in v0.13.0

func (w *Workbench) FilesBottom()

func (*Workbench) FilesDown added in v0.13.0

func (w *Workbench) FilesDown()

func (*Workbench) FilesTop added in v0.13.0

func (w *Workbench) FilesTop()

FilesTop/FilesBottom jump the files cursor to the first/last entry.

func (*Workbench) FilesUp added in v0.13.0

func (w *Workbench) FilesUp()

func (*Workbench) Review added in v0.13.0

func (w *Workbench) Review() ReviewPane

func (*Workbench) Root added in v0.13.0

func (w *Workbench) Root() string

func (*Workbench) SessionTitle added in v0.13.0

func (w *Workbench) SessionTitle() string

SessionTitle reports the session the panel is currently targeting ("" before the first SetSession).

func (*Workbench) SetFiles added in v0.13.0

func (w *Workbench) SetFiles(root string, paths []string)

SetFiles installs the files-tab listing (repo-relative paths).

func (*Workbench) SetReview added in v0.13.0

func (w *Workbench) SetReview(p ReviewPane)

SetReview installs (or clears, with nil) the review pane and sizes it. Callers must pass either a non-nil ReviewPane or an untyped nil; a nil typed pointer boxed into the interface would make the != nil check below misbehave.

func (*Workbench) SetSession added in v0.13.0

func (w *Workbench) SetSession(title, root string)

SetSession retargets the panel to a different session. Clears the per-session content (document, file list) and resumes follow mode. No-op when the title is unchanged.

func (*Workbench) SetSize added in v0.13.0

func (w *Workbench) SetSize(width, height int)

func (*Workbench) SetTab added in v0.13.0

func (w *Workbench) SetTab(t WorkbenchTab)

func (*Workbench) String added in v0.13.0

func (w *Workbench) String() string

String renders the panel: tab strip as the first content row inside the border, body clipped to the remaining inner box. lipgloss Width/Height are total (border-inclusive) and Height is a minimum — MaxHeight does the capping (repo gotcha). MaxHeight's own truncation is not trusted here either: the body is explicitly clipped to its line budget before rendering, since Height/MaxHeight interaction with border styles has misbehaved in this repo before.

func (*Workbench) Tab added in v0.13.0

func (w *Workbench) Tab() WorkbenchTab

type WorkbenchTab added in v0.13.0

type WorkbenchTab int

WorkbenchTab enumerates the right panel's content tabs.

const (
	WbTabMarkdown WorkbenchTab = iota
	WbTabDiff
	WbTabFiles
	WbTabTerminal
	WbTabReview
)

type WorkspaceTabBar

type WorkspaceTabBar struct {
	// contains filtered or unexported fields
}

WorkspaceTabBar renders a row of workspace tabs at the top of the TUI.

func NewWorkspaceTabBar

func NewWorkspaceTabBar() *WorkspaceTabBar

NewWorkspaceTabBar creates a new workspace tab bar.

func (*WorkspaceTabBar) Height

func (b *WorkspaceTabBar) Height() int

Height returns the rendered height: 0 when empty, 3 when tabs are present (top border + content + bottom border).

func (*WorkspaceTabBar) SetStatuses

func (b *WorkspaceTabBar) SetStatuses(statuses []TabStatus)

SetStatuses updates the per-tab status indicators.

func (*WorkspaceTabBar) SetWidth

func (b *WorkspaceTabBar) SetWidth(w int)

SetWidth sets the available width for the tab bar.

func (*WorkspaceTabBar) SetWorkspaces

func (b *WorkspaceTabBar) SetWorkspaces(names []string, focused int)

SetWorkspaces updates the displayed workspace names and focused index.

func (*WorkspaceTabBar) String

func (b *WorkspaceTabBar) String() string

String renders the tab bar. Returns "" when there are no workspaces.

Directories

Path Synopsis
Package overlay implements the modal dialogs layered above the main TUI — the text-input overlay for new instances and prompts, the confirmation overlay for destructive actions, and the branch, profile, and workspace pickers.
Package overlay implements the modal dialogs layered above the main TUI — the text-input overlay for new instances and prompts, the confirmation overlay for destructive actions, and the branch, profile, and workspace pickers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL