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 session.Instance state and emit strings; they do not mutate instances or spawn goroutines. Event handling happens in the app layer.
Index ¶
- Constants
- Variables
- func AdjustPreviewWidth(width int) int
- func ApplyTheme(name string) bool
- func ContentTailLines(screen string, n int) []string
- func CurrentThemeName() string
- func DisplayIndex(items []*session.Instance, i int) int
- func IsMarkdownPath(path string) bool
- func RegisterThemeHook(fn func())
- func RenderCard(d CardData, density CardDensity, width int) string
- func SortForOverview(items []*session.Instance) []int
- func TailLines(screen string, n int) []string
- func ThemeNames() []string
- type CardData
- type CardDensity
- type DiffPane
- func (d *DiffPane) GotoBottom()
- func (d *DiffPane) GotoTop()
- func (d *DiffPane) PageDown()
- func (d *DiffPane) PageUp()
- func (d *DiffPane) ScrollDown()
- func (d *DiffPane) ScrollPercent() float64
- func (d *DiffPane) ScrollUp()
- func (d *DiffPane) SetDiff(instance *session.Instance)
- func (d *DiffPane) SetSize(width, height int)
- func (d *DiffPane) String() string
- type ErrBox
- type GroupState
- type List
- func (l *List) AddInstance(instance *session.Instance)
- func (l *List) Bottom()
- func (l *List) Down()
- func (l *List) GetInstanceByTitle(title string) *session.Instance
- func (l *List) GetInstances() []*session.Instance
- func (l *List) GetSelectedInstance() *session.Instance
- func (l *List) NumInstances() int
- func (l *List) PageDown()
- func (l *List) PageUp()
- func (l *List) PeerSections() []PeerSection
- func (l *List) RemoveInstance(inst *session.Instance)
- func (l *List) ReplaceInstance(old, replacement *session.Instance) bool
- func (l *List) SelectInstance(target *session.Instance)
- func (l *List) SelectedIdx() int
- func (l *List) SetPeerSections(peers []PeerSection)
- func (l *List) SetSelectedInstance(idx int)
- func (l *List) SetSessionPreviewSize(width, height int) (err error)
- func (l *List) SetSize(width, height int)
- func (l *List) SetWorkspaceName(name string)
- func (l *List) String() string
- func (l *List) Top()
- func (l *List) Up()
- type MarkdownPane
- func (m *MarkdownPane) ApplySaved(raw string, mtime time.Time)
- func (m *MarkdownPane) CancelEdit()
- func (m *MarkdownPane) Clear()
- func (m *MarkdownPane) EditDirty() bool
- func (m *MarkdownPane) EditValue() string
- func (m *MarkdownPane) Editing() bool
- func (m *MarkdownPane) Following() bool
- func (m *MarkdownPane) HandleEditKey(msg tea.KeyPressMsg)
- func (m *MarkdownPane) Mtime() time.Time
- func (m *MarkdownPane) PageDown()
- func (m *MarkdownPane) PageUp()
- func (m *MarkdownPane) Path() string
- func (m *MarkdownPane) Scroll() int
- func (m *MarkdownPane) ScrollBottom()
- func (m *MarkdownPane) ScrollDown()
- func (m *MarkdownPane) ScrollTop()
- func (m *MarkdownPane) ScrollUp()
- func (m *MarkdownPane) SetDocument(path, raw string, mtime time.Time)
- func (m *MarkdownPane) SetFollowing(f bool)
- func (m *MarkdownPane) SetSize(width, height int)
- func (m *MarkdownPane) StartEdit() bool
- func (m *MarkdownPane) View() string
- type Menu
- func (m *Menu) ClearKeydown()
- func (m *Menu) Instance() *session.Instance
- func (m *Menu) Keydown(name keys.KeyName)
- func (m *Menu) SetInstance(instance *session.Instance)
- func (m *Menu) SetSize(width, height int)
- func (m *Menu) SetState(state MenuState)
- func (m *Menu) State() MenuState
- func (m *Menu) String() string
- type MenuState
- type Overview
- type OverviewCursor
- type OverviewData
- type OverviewGroup
- type PeerSection
- type PreviewPane
- func (p *PreviewPane) BeginSelection(row, col int)
- func (p *PreviewPane) ClearSelection()
- func (p *PreviewPane) ExtendSelection(row, col int)
- func (p *PreviewPane) GotoBottom(instance *session.Instance) error
- func (p *PreviewPane) GotoTop(instance *session.Instance) error
- func (p *PreviewPane) IsScrolling() bool
- func (p *PreviewPane) PageDown(instance *session.Instance) error
- func (p *PreviewPane) PageUp(instance *session.Instance) error
- func (p *PreviewPane) ResetToNormalMode(instance *session.Instance) error
- func (p *PreviewPane) ScrollDown(instance *session.Instance) error
- func (p *PreviewPane) ScrollPercent() float64
- func (p *PreviewPane) ScrollUp(instance *session.Instance) error
- func (p *PreviewPane) SelectedText() string
- func (p *PreviewPane) SetSize(width, maxHeight int)
- func (p *PreviewPane) ShowingFallback() bool
- func (p *PreviewPane) String() string
- func (p *PreviewPane) UpdateContent(instance *session.Instance) error
- type QuickInputAction
- type QuickInputBar
- type QuickInputTarget
- type ReviewPane
- type ScrollModel
- func (m *ScrollModel) AdvanceAndRender(src scrollSource, rows int) (window string, live bool, ok bool)
- func (m *ScrollModel) GotoTop(src scrollSource)
- func (m *ScrollModel) IsScrolling() bool
- func (m *ScrollModel) NeedsAltProbe() bool
- func (m *ScrollModel) NewLinesBelow() int
- func (m *ScrollModel) PageDown(src scrollSource, height int) error
- func (m *ScrollModel) PageUp(src scrollSource, height int) error
- func (m *ScrollModel) Reset()
- func (m *ScrollModel) ScrollBy(src scrollSource, delta int)
- func (m *ScrollModel) ScrollDown(src scrollSource) error
- func (m *ScrollModel) ScrollPercent(src scrollSource) float64
- func (m *ScrollModel) ScrollUp(src scrollSource) error
- func (m *ScrollModel) SetAltProbe(alt bool)
- type SplitPane
- func (s *SplitPane) AdjustAgentRatio(delta float64) float64
- func (s *SplitPane) AgentContentHeight() int
- func (s *SplitPane) AgentRatio() float64
- func (s *SplitPane) BeginSelection(pane, row, col int)
- func (s *SplitPane) CleanupTerminal()
- func (s *SplitPane) ClearSelections()
- func (s *SplitPane) CurrentTerminalSessionName() string
- func (s *SplitPane) CursorScreenPosition(instance *session.Instance) (x, y int, cur vt.Cursor, ok bool)
- func (s *SplitPane) DetachTerminalForInstance(title string) *tmux.TmuxSession
- func (s *SplitPane) ExtendSelection(pane, row, col int)
- func (s *SplitPane) ForwardTerminalFocus(in bool)
- func (s *SplitPane) ForwardTerminalMouse(cb, col, row int, press bool) error
- func (s *SplitPane) GetAgentSize() (width, height int)
- func (s *SplitPane) GetFocusedPane() int
- func (s *SplitPane) GotoBottom()
- func (s *SplitPane) GotoTop()
- func (s *SplitPane) HitTest(localX, y int) (pane, row, col int, ok bool)
- func (s *SplitPane) InjectTerminalSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)
- func (s *SplitPane) Instance() *session.Instance
- func (s *SplitPane) IsAgentInScrollMode() bool
- func (s *SplitPane) IsDiffVisible() bool
- func (s *SplitPane) IsTerminalHidden() bool
- func (s *SplitPane) IsTerminalInScrollMode() bool
- func (s *SplitPane) PageDown()
- func (s *SplitPane) PageTerminalDown()
- func (s *SplitPane) PageTerminalUp()
- func (s *SplitPane) PageUp()
- func (s *SplitPane) PasteTerminal(text string) error
- func (s *SplitPane) ResetAgentToNormalMode(instance *session.Instance) error
- func (s *SplitPane) ResetTerminalToNormalMode()
- func (s *SplitPane) ScrollAgentDown()
- func (s *SplitPane) ScrollAgentUp()
- func (s *SplitPane) ScrollDiffDown()
- func (s *SplitPane) ScrollDiffUp()
- func (s *SplitPane) ScrollDown()
- func (s *SplitPane) ScrollTerminalDown()
- func (s *SplitPane) ScrollTerminalUp()
- func (s *SplitPane) ScrollUp()
- func (s *SplitPane) SelectedText(pane int) string
- func (s *SplitPane) SendTerminalKeysRaw(b []byte) error
- func (s *SplitPane) SendTerminalKeysToInstance(title, text string) error
- func (s *SplitPane) SendTerminalPrompt(text string) error
- func (s *SplitPane) SetAgentRatio(r float64)
- func (s *SplitPane) SetFocusedPane(pane int)
- func (s *SplitPane) SetInlineAttach(attached bool)
- func (s *SplitPane) SetInstance(instance *session.Instance)
- func (s *SplitPane) SetSize(width, height int)
- func (s *SplitPane) SetTerminalHidden(h bool)
- func (s *SplitPane) String() string
- func (s *SplitPane) Terminal() *TerminalPane
- func (s *SplitPane) TerminalTmuxSession() *tmux.TmuxSession
- func (s *SplitPane) ToggleDiff()
- func (s *SplitPane) UpdateAgent(instance *session.Instance) error
- func (s *SplitPane) UpdateDiff(instance *session.Instance)
- func (s *SplitPane) UpdateTerminal(instance *session.Instance) error
- type SubagentRow
- type TabStatus
- type TerminalPane
- func (t *TerminalPane) BeginSelection(row, col int)
- func (t *TerminalPane) ClearSelection()
- func (t *TerminalPane) Close()
- func (t *TerminalPane) CurrentTmuxSession() *tmux.TmuxSession
- func (t *TerminalPane) CursorState() (vt.Cursor, bool)
- func (t *TerminalPane) DetachAll() []*tmux.TmuxSession
- func (t *TerminalPane) DetachExcept(keep map[string]bool) []*tmux.TmuxSession
- func (t *TerminalPane) DetachSessionForInstance(title string) *tmux.TmuxSession
- func (t *TerminalPane) ExtendSelection(row, col int)
- func (t *TerminalPane) ForwardFocus(in bool)
- func (t *TerminalPane) ForwardMouse(cb, col, row int, press bool) error
- func (t *TerminalPane) GotoBottom()
- func (t *TerminalPane) GotoTop() error
- func (t *TerminalPane) InjectSessionForTest(title string, ts *tmux.TmuxSession, worktreePath string)
- func (t *TerminalPane) IsScrolling() bool
- func (t *TerminalPane) PageDown() error
- func (t *TerminalPane) PageUp() error
- func (t *TerminalPane) Paste(text string) error
- func (t *TerminalPane) ResetToNormalMode()
- func (t *TerminalPane) ScrollDown() error
- func (t *TerminalPane) ScrollPercent() float64
- func (t *TerminalPane) ScrollUp() error
- func (t *TerminalPane) SelectedText() string
- func (t *TerminalPane) SendKeysRaw(b []byte) error
- func (t *TerminalPane) SendKeysToInstance(title, text string) error
- func (t *TerminalPane) SendPrompt(text string) error
- func (t *TerminalPane) SetSize(width, height int)
- func (t *TerminalPane) ShowingFallback() bool
- func (t *TerminalPane) String() string
- func (t *TerminalPane) UpdateContent(instance *session.Instance) error
- type Theme
- type Workbench
- func (w *Workbench) Diff() *DiffPane
- func (w *Workbench) FileUnderCursor() (string, bool)
- func (w *Workbench) FilesBottom()
- func (w *Workbench) FilesDown()
- func (w *Workbench) FilesTop()
- func (w *Workbench) FilesUp()
- func (w *Workbench) Review() ReviewPane
- func (w *Workbench) Root() string
- func (w *Workbench) SessionTitle() string
- func (w *Workbench) SetFiles(root string, paths []string)
- func (w *Workbench) SetReview(p ReviewPane)
- func (w *Workbench) SetSession(title, root string)
- func (w *Workbench) SetSize(width, height int)
- func (w *Workbench) SetTab(t WorkbenchTab)
- func (w *Workbench) String() string
- func (w *Workbench) Tab() WorkbenchTab
- type WorkbenchTab
- type WorkspaceTabBar
Constants ¶
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).
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.
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.
const DefaultThemeName = "afterglow"
DefaultThemeName is applied at startup when config names no theme (or an unknown one).
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.
Variables ¶
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.
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.
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 AdjustPreviewWidth ¶
AdjustPreviewWidth adjusts the width of the preview pane per PreviewWidthPercent.
func ApplyTheme ¶ added in v0.13.0
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
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
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
IsMarkdownPath reports whether path has a markdown extension.
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 SortForOverview ¶ added in v0.13.0
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
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 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 ("sandbox request", "dialog open"), from the agent roster
// via sanitizeCardText. Empty when unknown — non-Claude agents, and any
// status the pane scraper rather than the roster 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 session.Instance.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
}
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
BuildCardData snapshots inst into a CardData. spinnerFrame is the current spinner view (pass "" when unavailable). tailN caps the live tail; 0 skips the screen read entirely (DensityLine callers). The tail comes from AgentPane.EmulatorScreen — in-memory only, so calling this per visible card per frame forks no subprocesses; snapshot-path instances simply render their status label instead of a tail.
func (CardData) NeedsAttention ¶ added in v0.13.0
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) 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) ScrollPercent ¶
ScrollPercent returns the viewport position as a fraction [0, 1].
func (*DiffPane) SetDiff ¶
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.
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
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 ¶
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
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().
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 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 Instance state beyond reordering; all status is read via the Instance accessors.
func NewList ¶
NewList constructs an empty List bound to the given spinner. Items are added later via AddInstance; the list is ready to render immediately.
func (*List) AddInstance ¶
AddInstance adds a new instance to the list.
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
GetInstanceByTitle returns the instance with the given title, or nil.
func (*List) GetInstances ¶
GetInstances returns all instances in the list
func (*List) GetSelectedInstance ¶
GetSelectedInstance returns the currently selected instance
func (*List) NumInstances ¶
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) RemoveInstance ¶ added in v0.13.0
RemoveInstance removes the given instance by pointer identity, no-oping when this list does not contain it. It is the list's only removal: identity, never the selection or a title, since two workspaces can hold same-titled instances, and completions resolve against every slot's list, not just the focused one. Only in-memory bookkeeping happens here; the caller runs any Kill (tmux, worktree) off the Update goroutine.
func (*List) ReplaceInstance ¶ added in v0.13.0
ReplaceInstance puts replacement in old's row (old found by identity), so the list order and the selection's row are unchanged. Reports whether old was in the list.
func (*List) SelectInstance ¶
SelectInstance finds and selects the given instance in the list.
func (*List) SelectedIdx ¶ added in v0.13.0
SelectedIdx returns the current selection index (for jump helpers).
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 ¶
SetSelectedInstance sets the selected index. Noop if the index is out of bounds.
func (*List) SetSessionPreviewSize ¶
SetSessionPreviewSize sets the height and width for the tmux sessions. This makes the stdout line have the correct width and height.
func (*List) SetWorkspaceName ¶
SetWorkspaceName sets 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 ¶
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 (*Menu) ClearKeydown ¶
func (m *Menu) ClearKeydown()
ClearKeydown removes any active key-press highlight.
func (*Menu) Instance ¶ added in v0.13.0
Instance returns the instance the menu was last pointed at (nil for none).
func (*Menu) Keydown ¶
Keydown marks name as the most recently pressed key so the next render underlines its menu entry. ClearKeydown resets this.
func (*Menu) SetInstance ¶
SetInstance updates the current instance and refreshes menu options
func (*Menu) SetSize ¶
SetSize sets the width of the window. The menu will be centered horizontally within this width.
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
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) ToggleCollapse ¶ added in v0.13.0
ToggleCollapse flips a group's collapsed state (case-insensitive name).
type OverviewCursor ¶ added in v0.13.0
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
}
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 []*session.Instance
Order []int // SortForOverview(Items); empty when the group is empty
State GroupState
}
OverviewGroup is one open workspace's slice of the overview.
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 *session.Instance) error
GotoBottom returns to the live tail (TUI: a large wheel-down burst).
func (*PreviewPane) GotoTop ¶
func (p *PreviewPane) GotoTop(instance *session.Instance) 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 *session.Instance) error
PageDown scrolls down by half a pane height (or forwards a burst of wheel-downs).
func (*PreviewPane) PageUp ¶
func (p *PreviewPane) PageUp(instance *session.Instance) error
PageUp scrolls up by half a pane height (or forwards a burst of wheel-ups).
func (*PreviewPane) ResetToNormalMode ¶
func (p *PreviewPane) ResetToNormalMode(instance *session.Instance) error
ResetToNormalMode returns the pane to the live tail on both paths.
func (*PreviewPane) ScrollDown ¶
func (p *PreviewPane) ScrollDown(instance *session.Instance) 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 *session.Instance) 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) 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 *session.Instance) 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.
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
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
AdjustAgentRatio nudges the split by delta and returns the new ratio.
func (*SplitPane) AgentContentHeight ¶ added in v0.13.0
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
AgentRatio returns the agent pane's height share (default SplitAgentPercent when unset).
func (*SplitPane) BeginSelection ¶ added in v0.3.0
BeginSelection starts a selection on the given content pane (clearing any selection on the other pane first).
func (*SplitPane) CleanupTerminal ¶
func (s *SplitPane) CleanupTerminal()
CleanupTerminal closes the terminal session.
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
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 *session.Instance) (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) DetachTerminalForInstance ¶
func (s *SplitPane) DetachTerminalForInstance(title string) *tmux.TmuxSession
DetachTerminalForInstance removes the cached terminal entry for the given instance title and returns the popped tmux session, so the caller can Close it off the update goroutine. Returns nil if nothing was cached.
func (*SplitPane) ExtendSelection ¶ added in v0.3.0
ExtendSelection moves the active selection's cursor on the given content pane.
func (*SplitPane) ForwardTerminalFocus ¶ added in v0.8.0
ForwardTerminalFocus forwards a focus event to the terminal pane's session.
func (*SplitPane) ForwardTerminalMouse ¶ added in v0.3.0
ForwardTerminalMouse forwards one SGR mouse event to the terminal pane's session.
func (*SplitPane) GetAgentSize ¶
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 ¶
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
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
Instance returns the instance set by SetInstance (nil for none).
func (*SplitPane) IsAgentInScrollMode ¶
IsAgentInScrollMode returns true if the agent pane is scrolled away from the live tail.
func (*SplitPane) IsDiffVisible ¶
IsDiffVisible returns true if the diff overlay is currently shown.
func (*SplitPane) IsTerminalHidden ¶ added in v0.13.0
IsTerminalHidden reports whether the terminal pane is hidden.
func (*SplitPane) IsTerminalInScrollMode ¶
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
PasteTerminal sends text to the terminal pane's session as a bracketed paste.
func (*SplitPane) ResetAgentToNormalMode ¶
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
SelectedText returns the selected text of the given content pane.
func (*SplitPane) SendTerminalKeysRaw ¶
SendTerminalKeysRaw writes raw bytes to the terminal pane's tmux PTY.
func (*SplitPane) SendTerminalKeysToInstance ¶ added in v0.1.2
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 ¶
SendTerminalPrompt sends text followed by Enter to the terminal pane's tmux session.
func (*SplitPane) SetAgentRatio ¶ added in v0.13.0
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 ¶
SetFocusedPane sets focus to the specified pane.
func (*SplitPane) SetInlineAttach ¶
SetInlineAttach toggles whether inline-attach mode is active, controlling whether the focused-pane highlight is rendered.
func (*SplitPane) SetInstance ¶
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.
func (*SplitPane) SetSize ¶
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
SetTerminalHidden shows/hides the terminal pane; hidden gives the agent pane the full height.
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 ¶
UpdateAgent updates the agent (preview) pane content. Always updates since it's always visible.
func (*SplitPane) UpdateDiff ¶
UpdateDiff updates the diff pane content. Only updates when the overlay is visible.
type SubagentRow ¶ added in v0.13.0
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) DetachSessionForInstance ¶
func (t *TerminalPane) DetachSessionForInstance(title string) *tmux.TmuxSession
DetachSessionForInstance removes the cached terminal entry for the given title and returns the extracted tmux session so the caller can Close() it off the update goroutine. Returns nil if no session was cached. This is pure state bookkeeping — no blocking I/O — so it is safe to call from Update.
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 *session.Instance) 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) FileUnderCursor ¶ added in v0.13.0
FileUnderCursor resolves the cursor to an absolute path.
func (*Workbench) FilesBottom ¶ added in v0.13.0
func (w *Workbench) FilesBottom()
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) Review ¶ added in v0.13.0
func (w *Workbench) Review() ReviewPane
func (*Workbench) SessionTitle ¶ added in v0.13.0
SessionTitle reports the session the panel is currently targeting ("" before the first SetSession).
func (*Workbench) SetFiles ¶ added in v0.13.0
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
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) SetTab ¶ added in v0.13.0
func (w *Workbench) SetTab(t WorkbenchTab)
func (*Workbench) String ¶ added in v0.13.0
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.
Source Files
¶
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. |