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 DisplayIndex(items []*session.Instance, i int) int
- 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 InstanceRenderer
- type List
- func (l *List) AddInstance(instance *session.Instance) (finalize func())
- 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) PopSelectedForKill() *session.Instance
- func (l *List) RemoveInstanceByTitle(title string)
- func (l *List) RemoveInstanceByTitleAndRepo(title, repoName string)
- func (l *List) SelectInstance(target *session.Instance)
- 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 Menu
- type MenuState
- 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 SplitPane
- 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) IsAgentInScrollMode() bool
- func (s *SplitPane) IsDiffVisible() 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) 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) String() string
- 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 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) 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 WorkspaceTabBar
Constants ¶
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.
Variables ¶
var ( AdditionStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#22c55e")) DeletionStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#ef4444")) HunkStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#0ea5e9")) )
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 ( // BorderActive is the accent color used for focused borders, highlighted // tabs, and inline attach hints. BorderActive = compat.AdaptiveColor{Light: lipgloss.Color("#874BFD"), Dark: lipgloss.Color("#7D56F4")} // BorderMuted is the color for unfocused borders and muted chrome. BorderMuted = compat.AdaptiveColor{Light: lipgloss.Color("#999999"), Dark: lipgloss.Color("#555555")} // TextDim is for secondary labels, hints, and idle text elements. TextDim = compat.AdaptiveColor{Light: lipgloss.Color("#999999"), Dark: lipgloss.Color("#666666")} // TitleAccent highlights overlay titles and the help panel heading. // Matches BorderActive on dark terminals. TitleAccent = lipgloss.Color("#7D56F4") // HeaderAccent styles help-panel section headers. HeaderAccent = lipgloss.Color("#36CFC9") // KeyHighlight styles key glyphs in help content and prompts. KeyHighlight = lipgloss.Color("#FFCC00") // TextPrimary is the default foreground for overlay body text. TextPrimary = lipgloss.Color("#FFFFFF") // TextHint styles auxiliary help/instruction lines rendered inside overlays. TextHint = lipgloss.Color("#777777") // SelectionBg is the background for selected rows in list-style overlays. SelectionBg = lipgloss.Color("#dde4f0") // SelectionFg pairs with SelectionBg for selected-row foreground text. SelectionFg = lipgloss.Color("#1a1a1a") // DangerAccent borders confirmation overlays for destructive actions. DangerAccent = lipgloss.Color("#de613e") // OverlayBorder is the ANSI accent used for overlay borders and the // selected-row background in pickers that opt into ANSI palette colors. // Kept distinct from TitleAccent because ANSI 62 maps to the user's // terminal palette and renders differently from the hex equivalent. OverlayBorder = lipgloss.Color("62") // OverlaySelectedFg is the foreground paired with OverlayBorder when used // as a selection background (ANSI 0 = terminal background). OverlaySelectedFg = lipgloss.Color("0") // OverlayItemFg is the foreground for unselected items in ANSI pickers. OverlayItemFg = lipgloss.Color("7") // OverlayHintFg styles the trailing instruction line in ANSI pickers // ("↑/↓ to select, enter to confirm"). OverlayHintFg = lipgloss.Color("240") )
Shared color palette. Referenced by style vars across ui/ and app/ so the theme can be retuned in one place.
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 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.
Types ¶
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.
func (*ErrBox) SetError ¶
SetError replaces the currently displayed error. 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). An active error takes precedence over info in String().
type InstanceRenderer ¶
type InstanceRenderer struct {
// contains filtered or unexported fields
}
InstanceRenderer handles rendering of session.Instance objects
func (*InstanceRenderer) Render ¶
func (r *InstanceRenderer) Render(i *session.Instance, idx int, selected bool, hasMultipleRepos bool) string
Render produces the single-line representation of instance i at the given index, applying the style preset matching the instance's status and selection flag. hasMultipleRepos controls whether a repo badge is appended to disambiguate cross-workspace lists.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is the left-panel instance list. It owns the selection cursor and viewport scroll offset, and delegates per-row rendering to InstanceRenderer. 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. It returns a finalizer function that should be called when the instance is started. If the instance was restored from storage or is paused, you can call the finalizer immediately. When creating a new one and entering the name, you want to call the finalizer once the name is done.
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) PopSelectedForKill ¶
PopSelectedForKill removes the currently selected instance from the list and returns it so the caller can run the blocking Kill() (tmux + worktree cleanup) off the Bubble Tea update goroutine. Returns nil when the list is empty or the selected item is a workspace terminal (which cannot be killed).
Only in-memory bookkeeping happens here: repo-name unregister, slice pop, selectedIdx adjustment. No subprocesses are spawned.
func (*List) RemoveInstanceByTitle ¶
RemoveInstanceByTitle removes an instance from the list by title. Unlike Kill(), this does not perform I/O (no tmux/worktree cleanup) — the caller is responsible for that. This is safe to call from the main event loop after a Cmd goroutine has already performed I/O cleanup.
This variant reads the repo name from the instance itself, which only works while the instance is still started. Callers that run this after Instance.Kill() has zeroed out the backend should use RemoveInstanceByTitleAndRepo with a pre-captured name instead.
func (*List) RemoveInstanceByTitleAndRepo ¶ added in v0.1.1
RemoveInstanceByTitleAndRepo is RemoveInstanceByTitle with a pre-captured repo name, used by the kill path: Instance.Kill() clears the git worktree before this runs, so a post-hoc RepoName() lookup would fail and the repo counter would leak. An empty repoName skips rmRepo (used when the pre-capture itself errored).
func (*List) SelectInstance ¶
SelectInstance finds and selects the given instance in the list.
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 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) 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 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 scrollOffset 0, and when scrolled paints a window into tmux's authoritative history (capture-pane -S -) while 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.
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 scrollOffset 0 it tails the live emulator screen; when scrolled it windows 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 SplitPane ¶
type SplitPane struct {
// contains filtered or unexported fields
}
SplitPane composes the right-hand side of the TUI: an agent preview on top (70%), a terminal pane below (30%), 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) 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) 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) 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.
func (*SplitPane) ScrollAgentUp ¶
func (s *SplitPane) ScrollAgentUp()
ScrollAgentUp scrolls the agent pane explicitly, ignoring focus/diff.
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.
func (*SplitPane) ScrollTerminalUp ¶
func (s *SplitPane) ScrollTerminalUp()
ScrollTerminalUp scrolls the terminal pane explicitly.
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) 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 70/30 agent/terminal split for the given container dimensions and propagates widths to every child pane, including the diff overlay which uses the full inner height.
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 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) 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.
func (*TerminalPane) GotoTop ¶
func (t *TerminalPane) GotoTop() error
GotoTop jumps to the oldest scrollback line.
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.
func (*TerminalPane) PageUp ¶
func (t *TerminalPane) PageUp() error
PageUp scrolls up by half a pane height.
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.
func (*TerminalPane) ScrollDown ¶
func (t *TerminalPane) ScrollDown() error
ScrollDown scrolls one line down toward the live tail.
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 scrollback.
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 scrollOffset 0 it tails the live emulator screen (capture-pane fallback when no emulator); when scrolled it paints a window of the session's scrollback at the offset.
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. |