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
- 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) 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) 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) SetSize(width, maxHeight int)
- func (p *PreviewPane) String() string
- func (p *PreviewPane) UpdateContent(instance *session.Instance) error
- type QuickInputAction
- type QuickInputBar
- type QuickInputTarget
- type SplitPane
- func (s *SplitPane) CleanupTerminal()
- func (s *SplitPane) DetachTerminalForInstance(title string) *tmux.TmuxSession
- func (s *SplitPane) GetAgentSize() (width, height int)
- func (s *SplitPane) GetFocusedPane() int
- func (s *SplitPane) GotoBottom()
- func (s *SplitPane) GotoTop()
- 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) 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) SendTerminalKeysRaw(b []byte) 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) Close()
- func (t *TerminalPane) CurrentTmuxSession() *tmux.TmuxSession
- func (t *TerminalPane) DetachSessionForInstance(title string) *tmux.TmuxSession
- func (t *TerminalPane) GotoBottom()
- func (t *TerminalPane) GotoTop() error
- func (t *TerminalPane) IsScrolling() bool
- func (t *TerminalPane) PageDown() error
- func (t *TerminalPane) PageUp() error
- func (t *TerminalPane) ResetToNormalMode()
- func (t *TerminalPane) ScrollDown() error
- func (t *TerminalPane) ScrollPercent() float64
- func (t *TerminalPane) ScrollUp() error
- func (t *TerminalPane) SendKeysRaw(b []byte) error
- func (t *TerminalPane) SendPrompt(text string) error
- func (t *TerminalPane) SetSize(width, height int)
- 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 = lipgloss.AdaptiveColor{Light: "#874BFD", Dark: "#7D56F4"} // BorderMuted is the color for unfocused borders and muted chrome. BorderMuted = lipgloss.AdaptiveColor{Light: "#999999", Dark: "#555555"} // TextDim is for secondary labels, hints, and idle text elements. TextDim = lipgloss.AdaptiveColor{Light: "#999999", Dark: "#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") // ShadowFg is the drop-shadow color beneath floating overlays. ShadowFg = lipgloss.Color("#333333") // 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.
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) SetError ¶
SetError replaces the currently displayed error. Pass nil to hide the box on the next render; prefer Clear for clarity.
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 and auto-yes indicator. 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) 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 owns a bubbles/viewport for scrollback navigation and tracks which instance it last rendered so scroll position is reset on selection change rather than persisting stale offsets.
func NewPreviewPane ¶
func NewPreviewPane() *PreviewPane
NewPreviewPane constructs a PreviewPane with a zero-sized viewport; the caller must SetSize before the first render.
func (*PreviewPane) GotoBottom ¶
func (p *PreviewPane) GotoBottom(instance *session.Instance) error
GotoBottom exits scroll mode and returns to live tail.
func (*PreviewPane) GotoTop ¶
func (p *PreviewPane) GotoTop(instance *session.Instance) error
GotoTop jumps the viewport to the start of captured history.
func (*PreviewPane) IsScrolling ¶
func (p *PreviewPane) IsScrolling() bool
IsScrolling returns whether the preview pane is in scroll mode.
func (*PreviewPane) PageDown ¶
func (p *PreviewPane) PageDown(instance *session.Instance) error
PageDown scrolls down by half a viewport height.
func (*PreviewPane) PageUp ¶
func (p *PreviewPane) PageUp(instance *session.Instance) error
PageUp scrolls up by half a viewport height.
func (*PreviewPane) ResetToNormalMode ¶
func (p *PreviewPane) ResetToNormalMode(instance *session.Instance) error
ResetToNormalMode exits scroll mode and returns to normal mode
func (*PreviewPane) ScrollDown ¶
func (p *PreviewPane) ScrollDown(instance *session.Instance) error
ScrollDown scrolls down in the viewport
func (*PreviewPane) ScrollPercent ¶
func (p *PreviewPane) ScrollPercent() float64
ScrollPercent returns the viewport position as a fraction [0, 1]. Returns 1.0 when not in scroll mode (live tail is "at the bottom").
func (*PreviewPane) ScrollUp ¶
func (p *PreviewPane) ScrollUp(instance *session.Instance) error
ScrollUp scrolls up in the viewport
func (*PreviewPane) SetSize ¶
func (p *PreviewPane) SetSize(width, maxHeight int)
SetSize resizes the pane and the embedded viewport. maxHeight caps the visible height — content exceeding it is truncated with an ellipsis in normal mode or becomes scrollable in scroll mode.
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. It resets scroll mode when the selected instance changes, auto-exits scroll mode when the viewport has returned to the bottom, and falls back to splash text for nil / loading / paused instances.
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.KeyMsg) 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) CleanupTerminal ¶
func (s *SplitPane) CleanupTerminal()
CleanupTerminal closes the terminal session.
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) 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) IsAgentInScrollMode ¶
IsAgentInScrollMode returns true if the agent pane is in scroll mode.
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) 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) SendTerminalKeysRaw ¶
SendTerminalKeysRaw writes raw bytes to the terminal pane's tmux PTY.
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 and zero-sized viewport. The caller must SetSize before the first render and feed instances via UpdateContent.
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) 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) GotoBottom ¶
func (t *TerminalPane) GotoBottom()
GotoBottom exits scroll mode and returns to live tail.
func (*TerminalPane) GotoTop ¶
func (t *TerminalPane) GotoTop() error
GotoTop jumps the viewport to the start of captured history.
func (*TerminalPane) IsScrolling ¶
func (t *TerminalPane) IsScrolling() bool
IsScrolling returns whether the terminal pane is in scroll mode.
func (*TerminalPane) PageDown ¶
func (t *TerminalPane) PageDown() error
PageDown scrolls down by half a viewport height.
func (*TerminalPane) PageUp ¶
func (t *TerminalPane) PageUp() error
PageUp scrolls up by half a viewport height.
func (*TerminalPane) ResetToNormalMode ¶
func (t *TerminalPane) ResetToNormalMode()
ResetToNormalMode exits scroll mode and restores normal content display.
func (*TerminalPane) ScrollDown ¶
func (t *TerminalPane) ScrollDown() error
ScrollDown scrolls down in the viewport. Does not enter scroll mode from normal mode.
func (*TerminalPane) ScrollPercent ¶
func (t *TerminalPane) ScrollPercent() float64
ScrollPercent returns the viewport position as a fraction [0, 1]. Returns 1.0 when not in scroll mode (live tail is "at the bottom").
func (*TerminalPane) ScrollUp ¶
func (t *TerminalPane) ScrollUp() error
ScrollUp enters scroll mode (if not already) and scrolls up.
func (*TerminalPane) SendKeysRaw ¶
func (t *TerminalPane) SendKeysRaw(b []byte) error
SendKeysRaw writes raw bytes to the current terminal tmux PTY.
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) String ¶
func (t *TerminalPane) String() string
func (*TerminalPane) UpdateContent ¶
func (t *TerminalPane) UpdateContent(instance *session.Instance) error
UpdateContent captures the tmux pane output for the terminal session.
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. |