overlay

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Overview

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.

Every app-level overlay satisfies the Overlay interface so the app model can hold a single active overlay pointer rather than one nullable field per dialog type. Specialized surfaces (Submitted / Canceled flags, selected branch/profile/workspace) remain on the concrete types for callers that need richer signals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateCenterCoordinates

func CalculateCenterCoordinates(foregroundLines []string, backgroundLines []string, foregroundWidth, backgroundWidth int) (int, int)

CalculateCenterCoordinates returns the (x, y) origin needed to center a foreground block of the given width and line count inside a background of the given width and line count. Callers pass the result straight to PlaceOverlay when center=false.

func PlaceOverlay

func PlaceOverlay(
	x, y int,
	fg, bg string,
	center bool,
	opts ...WhitespaceOption,
) string

PlaceOverlay places fg on top of bg, fading the background behind it. If center is true, the foreground is centered on the background; otherwise, the provided x and y are used.

Types

type AccountChoice added in v0.14.0

type AccountChoice struct {
	Name string
	// Summary is the account's usage, e.g. "5h 12% · 7d 31%".
	Summary string
	// RCBlocked/RCReason mirror the account's own remote-control auth, so
	// the Remote Control row's blocked hint follows the selected account.
	RCBlocked bool
	RCReason  string
}

AccountChoice is one option on the Account row.

type AccountRequest added in v0.14.0

type AccountRequest struct {
	Kind AccountRequestKind
	Name string
}

AccountRequest is one action for app to carry out on account Name.

type AccountRequestKind added in v0.14.0

type AccountRequestKind int

AccountRequestKind names an action the user asked the Accounts screen for. The screen does no I/O; app carries each request out.

const (
	AccountRequestAdd AccountRequestKind = iota + 1
	AccountRequestLogin
	AccountRequestRemove
	AccountRequestSetDefault
)

type AccountRow added in v0.14.0

type AccountRow struct {
	Name  string
	Email string
	Plan  string
	// Usage is ui.AccountUsageText for the account.
	Usage string
	// Warning is "logged out", "not shared: settings.json", … or "".
	Warning   string
	IsDefault bool
}

AccountRow is one line of the Accounts screen, formatted by app.

type AccountsManager added in v0.14.0

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

AccountsManager is the Accounts drill-in of the Settings overlay: the Claude accounts with their login and usage, and keys to add, log in, remove, and pick the default. Rows are supplied (and refreshed) by app.

func NewAccountsManager added in v0.14.0

func NewAccountsManager(rows []AccountRow) *AccountsManager

NewAccountsManager creates the Accounts screen over rows.

func (*AccountsManager) HandleKeyPress added in v0.14.0

func (a *AccountsManager) HandleKeyPress(msg tea.KeyPressMsg) (closed bool)

HandleKeyPress processes one key press. closed reports whether the screen should return control to the parent SettingsOverlay.

func (*AccountsManager) Render added in v0.14.0

func (a *AccountsManager) Render() string

Render renders whichever mode is active.

func (*AccountsManager) SetNotice added in v0.14.0

func (a *AccountsManager) SetNotice(msg string)

SetNotice sets a warning that concerns every row, such as a credential in loom's environment that every account runs as, shown marked "⚠" above the rows; "" clears it.

func (*AccountsManager) SetRows added in v0.14.0

func (a *AccountsManager) SetRows(rows []AccountRow)

SetRows replaces the rows. The cursor follows the previously selected account by identity when it still exists (a refresh can reorder or insert rows; a position-based cursor would otherwise silently land on a different account — e.g. "enter" then setting the wrong default). A pending remove confirmation whose target vanished from the new rows is canceled rather than left to fire against whatever now sits in its old row.

func (*AccountsManager) SetWidth added in v0.14.0

func (a *AccountsManager) SetWidth(w int)

SetWidth propagates the available width to any embedded text input.

func (*AccountsManager) TakeRequest added in v0.14.0

func (a *AccountsManager) TakeRequest() (AccountRequest, bool)

TakeRequest returns and clears the pending request.

type BranchPicker

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

BranchPicker is an embeddable component for selecting a branch. It does not hold the full branch list — results are provided asynchronously via SetResults after each debounced search.

func NewBranchPicker

func NewBranchPicker() *BranchPicker

NewBranchPicker creates a new empty branch picker.

func (*BranchPicker) Blur

func (bp *BranchPicker) Blur()

Blur removes focus from the branch picker.

func (*BranchPicker) Focus

func (bp *BranchPicker) Focus()

Focus gives the branch picker focus.

func (*BranchPicker) GetFilter

func (bp *BranchPicker) GetFilter() string

GetFilter returns the current filter text.

func (*BranchPicker) GetFilterVersion

func (bp *BranchPicker) GetFilterVersion() uint64

GetFilterVersion returns a monotonically increasing version that changes on every filter edit.

func (*BranchPicker) GetSelectedBranch

func (bp *BranchPicker) GetSelectedBranch() string

GetSelectedBranch returns the selected branch name, or empty string for "New branch".

func (*BranchPicker) HandleKeyPress

func (bp *BranchPicker) HandleKeyPress(msg tea.KeyPressMsg) (consumed bool, filterChanged bool)

HandleKeyPress processes a key event. Returns (consumed, filterChanged).

func (*BranchPicker) IsFocused

func (bp *BranchPicker) IsFocused() bool

IsFocused returns whether the branch picker is focused.

func (*BranchPicker) Render

func (bp *BranchPicker) Render() string

Render renders the branch picker.

func (*BranchPicker) SetBaseBranchName added in v0.13.0

func (bp *BranchPicker) SetBaseBranchName(name string)

SetBaseBranchName records the ref new branches are cut from, for display only. It never affects what GetSelectedBranch reports.

func (*BranchPicker) SetResults

func (bp *BranchPicker) SetResults(branches []string, version uint64)

SetResults updates the branch list with search results. version must match filterVersion for the results to be accepted (prevents stale updates).

func (*BranchPicker) SetWidth

func (bp *BranchPicker) SetWidth(w int)

SetWidth sets the width of the branch picker.

type ClaudePreferences added in v0.3.0

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

ClaudePreferences is the Claude-specific preferences drill-in sub-screen. Structured as its own screen (rather than flat rows on the main settings list) so more Claude-adapter-specific preferences can be added later without growing that list — today it holds nine rows: Remote Control, Permission Mode, Model, 1M Context, Headroom Proxy, Effort, Cache TTL (1h), Loom Context, and Track Subagents.

authBlocked/authReason mirror session.RemoteControlAuth.Blocked()/ Reason, passed as plain values so this package stays decoupled from session (matching SettingsOverlay and every other overlay). They are a snapshot taken once at startup by the caller (m.rcAuth) — toggling Remote Control here does not re-probe auth; the existing session-creation-time gating (app/remote_control.go) already handles the incompatible-auth case once the toggle takes effect.

func NewClaudePreferences added in v0.3.0

func NewClaudePreferences(cfg *config.Config, authBlocked bool, authReason string) *ClaudePreferences

NewClaudePreferences creates the Claude Preferences sub-screen over cfg.

func (*ClaudePreferences) HandleKeyPress added in v0.3.0

func (c *ClaudePreferences) HandleKeyPress(msg tea.KeyPressMsg) (closed, changed bool)

HandleKeyPress processes one key press. closed reports whether the sub-screen should return control to the parent SettingsOverlay; changed reports whether cfg was mutated.

func (*ClaudePreferences) Render added in v0.3.0

func (c *ClaudePreferences) Render() string

Render renders the sub-screen.

func (*ClaudePreferences) SetWidth added in v0.3.0

func (c *ClaudePreferences) SetWidth(w int)

SetWidth sets the render width.

type ConfirmationOverlay

type ConfirmationOverlay struct {
	// Whether the overlay has been dismissed
	Dismissed bool

	// Callback function to be called when the user confirms (presses 'y')
	OnConfirm func()
	// Callback function to be called when the user cancels (presses 'n' or 'esc')
	OnCancel func()
	// Custom confirm key (defaults to 'y')
	ConfirmKey string
	// Custom cancel key (defaults to 'n')
	CancelKey string
	// contains filtered or unexported fields
}

ConfirmationOverlay represents a confirmation dialog overlay

func NewConfirmationOverlay

func NewConfirmationOverlay(message string) *ConfirmationOverlay

NewConfirmationOverlay creates a new confirmation dialog overlay with the given message

func (*ConfirmationOverlay) HandleKey

func (c *ConfirmationOverlay) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface. It delegates to HandleKeyPress and emits no tea.Cmd — callbacks are invoked synchronously inside HandleKeyPress.

func (*ConfirmationOverlay) HandleKeyPress

func (c *ConfirmationOverlay) HandleKeyPress(msg tea.KeyPressMsg) bool

HandleKeyPress processes a key press and updates the state Returns true if the overlay should be closed

func (*ConfirmationOverlay) Render

func (c *ConfirmationOverlay) Render(opts ...WhitespaceOption) string

Render renders the confirmation overlay

func (*ConfirmationOverlay) SetBorderColor

func (c *ConfirmationOverlay) SetBorderColor(col color.Color)

SetBorderColor sets the border color of the confirmation overlay

func (*ConfirmationOverlay) SetCancelKey

func (c *ConfirmationOverlay) SetCancelKey(key string)

SetCancelKey sets the key used to cancel the action

func (*ConfirmationOverlay) SetConfirmKey

func (c *ConfirmationOverlay) SetConfirmKey(key string)

SetConfirmKey sets the key used to confirm the action

func (*ConfirmationOverlay) SetSize

func (c *ConfirmationOverlay) SetSize(width, _ int)

SetSize satisfies the Overlay interface. ConfirmationOverlay uses only width; height is accepted but ignored.

func (*ConfirmationOverlay) SetWidth

func (c *ConfirmationOverlay) SetWidth(width int)

SetWidth sets the width of the confirmation overlay

func (*ConfirmationOverlay) View

func (c *ConfirmationOverlay) View() string

View satisfies the Overlay interface.

type ConfirmationTask

type ConfirmationTask struct {
	Sync  func()
	Async tea.Cmd
}

ConfirmationTask bundles the synchronous preparation and the asynchronous body of a confirmed action so the host can schedule them in the correct order without exposing two separate fields.

Sync runs first, on the main goroutine, and is the right place for state flips that must be visible to the very next render (e.g., setting a Loading status so the spinner appears while the async work runs). Async is the tea.Cmd dispatched afterward; it may return a message that reconciles the state.

func (ConfirmationTask) Run

func (t ConfirmationTask) Run() tea.Cmd

Run executes the task: Sync on the current goroutine, then returns Async for the host to dispatch. A zero-value task is a no-op.

type FileExplorerOverlay added in v0.1.1

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

FileExplorerOverlay is a full-right-pane modal that lists files in a root directory and invokes a caller-provided callback when the user picks one. It implements Overlay so the app-layer overlay routing machinery works unchanged.

The list is populated exactly once (at construction). Re-opening picks up anything the agent wrote meanwhile.

func NewFileExplorerOverlay added in v0.1.1

func NewFileExplorerOverlay(root string, files []string, open func(absPath string) tea.Cmd) *FileExplorerOverlay

NewFileExplorerOverlay constructs a focused overlay over files (paths relative to root). The openCallback receives the joined absolute path when the user confirms a selection.

func (*FileExplorerOverlay) HandleKey added in v0.1.1

func (f *FileExplorerOverlay) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey routes key events. Esc and Enter close the overlay (Enter also returns the open command). Arrow-style keys move the cursor within the filtered results; anything else is forwarded to the search input.

func (*FileExplorerOverlay) ResultCount added in v0.1.1

func (f *FileExplorerOverlay) ResultCount() int

ResultCount returns the number of currently-visible results. Exposed for tests; callers outside ui/overlay should prefer the visible-in-View counter when rendering.

func (*FileExplorerOverlay) SelectedPath added in v0.1.1

func (f *FileExplorerOverlay) SelectedPath() string

SelectedPath returns the absolute path of the current selection, or the empty string when no results are visible. Exposed for tests so they can assert on the selection without reaching into private fields.

func (*FileExplorerOverlay) SetSize added in v0.1.1

func (f *FileExplorerOverlay) SetSize(width, height int)

SetSize sizes the viewport to fit within the overlay chrome. feHeaderRows accounts for the title row, input row, spacer rows, and hint row; the remainder belongs to the scrollable file list.

func (*FileExplorerOverlay) View added in v0.1.1

func (f *FileExplorerOverlay) View() string

View composes the overlay content: title row, search input, match list (via the viewport), and a hint row. The body is wrapped in feBorder so the widget visually matches the diff overlay it sits beside in the UI.

type FileMatch added in v0.1.1

type FileMatch struct {
	Path       string
	Score      int
	MatchedIdx []int
}

FileMatch is a single scored result from FuzzyMatch. Path is the candidate as supplied by the caller (relative, forward-slash separated by convention); Score is the heuristic rank (higher is better); MatchedIdx holds the rune indices within Path that the pattern's runes matched against, so renderers can highlight them.

func FuzzyMatch added in v0.1.1

func FuzzyMatch(pattern string, candidates []string) []FileMatch

FuzzyMatch returns all candidates containing pattern as a case-insensitive subsequence, ranked best-first. Empty pattern is a pass-through that preserves input order with Score=0 so an unfiltered view renders in the caller's preferred (usually alphabetical) order.

The scoring heuristics favor what humans intuitively expect from a file picker:

  • filename-prefix hits (typing "ma" should surface main.go first),
  • contiguous streaks (typing "conf" should beat "c-o-n-f" scatter),
  • word-boundary starts (after '/', '-', '_', or case transitions),
  • matches in the filename over matches in a directory segment,
  • earlier-starting matches over later ones.

Ties break by shorter path first, so short canonical files win over verbose ones.

type IssuePicker added in v0.13.0

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

IssuePicker lists open issues with a type-to-filter line. Filtering matches the number (prefix) or the title (case-insensitive substring). Enter picks the highlighted visible row; Esc cancels.

func NewIssuePicker added in v0.13.0

func NewIssuePicker(rows []IssueRow) *IssuePicker

NewIssuePicker creates a picker over rows (may be nil while loading).

func (*IssuePicker) HandleKey added in v0.13.0

func (p *IssuePicker) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface.

func (*IssuePicker) HandleKeyPress added in v0.13.0

func (p *IssuePicker) HandleKeyPress(msg tea.KeyPressMsg) (bool, bool)

HandleKeyPress returns (committed, canceled) like MergePicker.

func (*IssuePicker) Render added in v0.13.0

func (p *IssuePicker) Render() string

Render draws the picker.

func (*IssuePicker) Selected added in v0.13.0

func (p *IssuePicker) Selected() *IssueRow

Selected returns the highlighted visible row, or nil when the filter hides everything.

func (*IssuePicker) SetRows added in v0.13.0

func (p *IssuePicker) SetRows(rows []IssueRow)

SetRows replaces the row set (e.g. when a poll lands while the picker is open), re-applies the filter, and keeps the cursor on the same issue when it survives. Re-anchoring by number rather than position matters because a poll can add or close issues, which shifts every index below the change — without it a refresh arriving between the user's last keystroke and Enter could retarget the selection silently.

func (*IssuePicker) SetSize added in v0.13.0

func (p *IssuePicker) SetSize(width, _ int)

SetSize satisfies the Overlay interface; only width is used.

func (*IssuePicker) SetStatus added in v0.13.0

func (p *IssuePicker) SetStatus(s string)

SetStatus shows a line under the header ("loading…", "gh unavailable: …"); "" hides it.

func (*IssuePicker) View added in v0.13.0

func (p *IssuePicker) View() string

View satisfies the Overlay interface.

func (*IssuePicker) VisibleNumbers added in v0.13.0

func (p *IssuePicker) VisibleNumbers() []int

VisibleNumbers lists the numbers of the rows the filter shows (tests).

type IssueRow added in v0.13.0

type IssueRow struct {
	Number int
	Title  string
	Labels []string
}

IssueRow is one selectable GitHub issue. Plain fields only so this package does not import session/github.

type LaunchOptions added in v0.5.0

type LaunchOptions = launch.Options

LaunchOptions is the value the modal edits; see launch.Options.

type MergePicker added in v0.3.0

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

MergePicker lets the user choose which session's branch to merge into the currently-focused ("target") session. Deliberately decoupled from session.Instance (plain string/int fields only) so this package doesn't need to import session — the caller (app.runMergeSelected) re-resolves the chosen row back to its core.InstanceView by its Index.

func NewMergePicker added in v0.3.0

func NewMergePicker(targetTitle string, rows []MergePickerRow) *MergePicker

NewMergePicker creates a merge picker for targetTitle (shown in the header) offering rows as the selectable sources.

func (*MergePicker) HandleKey added in v0.3.0

func (p *MergePicker) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface.

func (*MergePicker) HandleKeyPress added in v0.3.0

func (p *MergePicker) HandleKeyPress(msg tea.KeyPressMsg) (bool, bool)

HandleKeyPress processes navigation, digit-jump, and selection keys. Returns (committed, canceled). committed=true means the overlay should close; when committed, canceled=true means the user backed out via Esc/q rather than picking a row (SelectedRow may still be non-nil in that case — callers must check canceled first).

func (*MergePicker) Render added in v0.3.0

func (p *MergePicker) Render() string

Render renders the merge picker overlay.

func (*MergePicker) SelectedRow added in v0.3.0

func (p *MergePicker) SelectedRow() *MergePickerRow

SelectedRow returns the row currently highlighted, or nil if there are no rows.

func (*MergePicker) SetSize added in v0.3.0

func (p *MergePicker) SetSize(width, _ int)

SetSize satisfies the Overlay interface. Only width is used; height is accepted but ignored, matching WorkspacePicker.

func (*MergePicker) View added in v0.3.0

func (p *MergePicker) View() string

View satisfies the Overlay interface.

type MergePickerRow added in v0.3.0

type MergePickerRow struct {
	Index  int
	Title  string
	Branch string
	Status string
}

MergePickerRow is one selectable source session in the merge picker. Index is the session's original 1-based number from the main session list (ui.DisplayIndex) — NOT this row's position in the picker's own slice. Rows can have gaps (an ineligible session was filtered out upstream), which is deliberate: typing the digit the user already saw in the main list must land on the same session.

type Overlay

type Overlay interface {
	// View returns the overlay's current visual (matches the Bubble
	// Tea Model convention so overlays can stand in for a sub-model).
	View() string
	// HandleKey processes a single key press. closed reports whether
	// the overlay should be dismissed; cmd is an optional command the
	// host must dispatch (e.g., the dismiss callback for TextOverlay
	// or a branch-filter search kicked off by TextInputOverlay).
	HandleKey(msg tea.KeyPressMsg) (closed bool, cmd tea.Cmd)
	// SetSize reports the available rendering area. Overlays are free
	// to ignore dimensions they don't use.
	SetSize(width, height int)
}

Overlay is the shared contract for app-level overlays rendered above the main TUI. It unifies key routing, sizing, and rendering so the app model can hold a single active overlay rather than a handful of optional pointers.

The nine types that satisfy this interface today are ConfirmationOverlay, FileExplorerOverlay, SessionLaunchOptions, MergePicker, WorkspacePicker, TextInputOverlay, IssuePicker, SettingsOverlay, and TextOverlay (see the var _ Overlay assertions below). Each retains its own specialized surface for callers that need richer signals (Submitted/Canceled flags, branch filter introspection, selected workspace). This interface is the common subset required for dispatch.

type ProfilePicker

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

ProfilePicker is an embeddable component for selecting a profile. It displays a horizontal selector with left/right arrow navigation.

func NewProfilePicker

func NewProfilePicker(profiles []config.Profile) *ProfilePicker

NewProfilePicker creates a new profile picker with the given profiles. The first profile is selected by default.

func (*ProfilePicker) Blur

func (pp *ProfilePicker) Blur()

Blur removes focus from the profile picker.

func (*ProfilePicker) Focus

func (pp *ProfilePicker) Focus()

Focus gives the profile picker focus.

func (*ProfilePicker) GetSelectedProfile

func (pp *ProfilePicker) GetSelectedProfile() config.Profile

GetSelectedProfile returns the currently selected profile.

func (*ProfilePicker) HandleKeyPress

func (pp *ProfilePicker) HandleKeyPress(msg tea.KeyPressMsg) bool

HandleKeyPress processes a key event. Returns true if consumed.

func (*ProfilePicker) HasMultiple

func (pp *ProfilePicker) HasMultiple() bool

HasMultiple returns true if there is more than one profile to choose from.

func (*ProfilePicker) Render

func (pp *ProfilePicker) Render() string

Render renders the profile picker.

func (*ProfilePicker) SetWidth

func (pp *ProfilePicker) SetWidth(w int)

SetWidth sets the rendering width.

type ProfilesManager added in v0.3.0

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

ProfilesManager is the Profiles drill-in sub-screen: add/edit-program/ delete/set-default over cfg.Profiles. It operates on the raw cfg.Profiles slice directly (not config.Config.GetProfiles(), which synthesizes a row from DefaultProgram when Profiles is empty) — the Default Program row on the parent SettingsOverlay is the single source of truth for "what runs by default"; this screen only manages the named list. Renaming an existing profile isn't supported in v1 — only its program string — since that's the field users actually need to tweak (e.g. a model flag).

func NewProfilesManager added in v0.3.0

func NewProfilesManager(cfg *config.Config) *ProfilesManager

NewProfilesManager creates the Profiles sub-screen over cfg.

func (*ProfilesManager) HandleKeyPress added in v0.3.0

func (p *ProfilesManager) HandleKeyPress(msg tea.KeyPressMsg) (closed, changed bool)

HandleKeyPress processes one key press. closed reports whether the sub-screen should return control to the parent SettingsOverlay; changed reports whether cfg was mutated.

func (*ProfilesManager) Render added in v0.3.0

func (p *ProfilesManager) Render() string

Render renders whichever mode is active.

func (*ProfilesManager) SetWidth added in v0.3.0

func (p *ProfilesManager) SetWidth(w int)

SetWidth propagates the available width to any embedded text input.

func (*ProfilesManager) TakeError added in v0.3.0

func (p *ProfilesManager) TakeError() error

TakeError returns and clears the last validation/precondition error (e.g. deleting the default profile). Callers poll this after HandleKeyPress.

type SessionLaunchOptions added in v0.5.0

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

SessionLaunchOptions is the per-instance "Session Launch Options" modal shown right before a new session starts. Unlike ClaudePreferences, which edits *config.Config directly and persists on every change, this edits a local LaunchOptions value that the caller applies to just one instance — closing without saving anything to disk.

func NewSessionLaunchOptions added in v0.5.0

func NewSessionLaunchOptions(initial LaunchOptions, authBlocked bool, authReason string) *SessionLaunchOptions

NewSessionLaunchOptions creates the modal seeded with initial (typically the global config's current values).

func (*SessionLaunchOptions) AccountsShown added in v0.14.0

func (l *SessionLaunchOptions) AccountsShown() bool

AccountsShown reports whether the Account row is showing, so the caller refreshes only a modal that was given accounts (a Claude launch) and never adds the row to one that wasn't.

func (*SessionLaunchOptions) HandleKey added in v0.5.0

func (l *SessionLaunchOptions) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface. State handlers that need the confirmed signal call HandleKeyPress directly instead (mirrors SettingsOverlay.HandleKey/HandleKeyPress).

func (*SessionLaunchOptions) HandleKeyPress added in v0.5.0

func (l *SessionLaunchOptions) HandleKeyPress(msg tea.KeyPressMsg) (closed, confirmed bool)

HandleKeyPress processes one key press. closed reports whether the modal should close (either canceled or confirmed); confirmed distinguishes the two — the caller only applies Options() and starts the instance when confirmed is true.

func (*SessionLaunchOptions) Options added in v0.5.0

func (l *SessionLaunchOptions) Options() LaunchOptions

Options returns the current (possibly edited) launch options.

func (*SessionLaunchOptions) Render added in v0.5.0

func (l *SessionLaunchOptions) Render() string

Render renders the modal.

func (*SessionLaunchOptions) SetAccountNotice added in v0.14.0

func (l *SessionLaunchOptions) SetAccountNotice(msg string)

SetAccountNotice sets the line shown under the Account row, which explains a preselection the user did not make, such as "max-2 was removed — this session will run on default"; "" clears it. While set, the row shows even with a single choice, so that choice is visible before the launch is confirmed. Choosing another account retires it.

func (*SessionLaunchOptions) SetAccounts added in v0.14.0

func (l *SessionLaunchOptions) SetAccounts(choices []AccountChoice)

SetAccounts supplies the Account row's choices, default first. Fewer than two hides the row. An Account the choices don't include (removed, or never set) falls to the first choice. If the row was showing and just disappeared (an account was removed elsewhere, dropping the count below two) while the cursor sat on it, the cursor is pulled back onto the new last row so it can't point past the list, and the selection it held — no longer choosable — resets to the first remaining choice, or "" if none are left.

func (*SessionLaunchOptions) SetBranchPrefixLocked added in v0.13.0

func (l *SessionLaunchOptions) SetBranchPrefixLocked(branch string)

SetBranchPrefixLocked switches the Branch Prefix row to a read-only display of branch. Used on the restart path, where the session's branch already exists and an editable prefix would imply a rename that cannot happen.

func (*SessionLaunchOptions) SetSize added in v0.5.0

func (l *SessionLaunchOptions) SetSize(width, _ int)

SetSize satisfies the Overlay interface.

func (*SessionLaunchOptions) SetWidth added in v0.5.0

func (l *SessionLaunchOptions) SetWidth(w int)

SetWidth sets the render width.

func (*SessionLaunchOptions) View added in v0.5.0

func (l *SessionLaunchOptions) View() string

View satisfies the Overlay interface.

type SettingsOverlay added in v0.3.0

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

SettingsOverlay is the config.json editor: a vertical list of scalar fields plus two drill-in rows (Profiles, Claude Preferences). It owns no persistence — HandleKeyPress's second return value reports whether a field changed; the caller (app.handleStateSettingsKey) is responsible for config.SaveConfigTo and refreshing the home fields that shadow cfg (m.program).

authBlocked/authReason mirror session.RemoteControlAuth.Blocked()/ Reason, passed as plain values rather than the session type so this package stays decoupled from session (matching every other overlay).

func NewSettingsOverlay added in v0.3.0

func NewSettingsOverlay(cfg *config.Config, authBlocked bool, authReason string) *SettingsOverlay

NewSettingsOverlay creates the settings overlay over cfg.

func (*SettingsOverlay) HandleKey added in v0.3.0

func (s *SettingsOverlay) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface. State handlers that need the changed signal call HandleKeyPress directly instead (mirrors WorkspacePicker.HandleKey/HandleKeyPress).

func (*SettingsOverlay) HandleKeyPress added in v0.3.0

func (s *SettingsOverlay) HandleKeyPress(msg tea.KeyPressMsg) (closed, changed bool)

HandleKeyPress processes one key press. closed reports whether the whole overlay should be dismissed (only true from browsing mode); changed reports whether cfg was mutated, so the caller knows to persist and refresh its shadow fields.

func (*SettingsOverlay) Render added in v0.3.0

func (s *SettingsOverlay) Render() string

Render renders whichever mode is active: the main row list, an embedded text edit, or a nested sub-screen.

func (*SettingsOverlay) SetAccountNotice added in v0.14.0

func (s *SettingsOverlay) SetAccountNotice(msg string)

SetAccountNotice supplies the Accounts screen's screen-wide notice (AccountsManager.SetNotice), updating the screen if it is open; "" clears it.

func (*SettingsOverlay) SetAccountRows added in v0.14.0

func (s *SettingsOverlay) SetAccountRows(rows []AccountRow)

SetAccountRows supplies the Accounts screen's rows (app refreshes them as probes land), updating the screen if it is open.

func (*SettingsOverlay) SetSize added in v0.3.0

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

SetSize satisfies the Overlay interface. A resize while a sub-screen is open (the window changed, or the overlay was just opened) must reach it too — otherwise it keeps rendering at whatever width it was created with, which for Accounts specifically must track the real width to stay wrap-free (see AccountsManager.contentWidth).

func (*SettingsOverlay) TakeAccountRequest added in v0.14.0

func (s *SettingsOverlay) TakeAccountRequest() (AccountRequest, bool)

TakeAccountRequest returns and clears the Accounts screen's pending request. Callers poll it after HandleKeyPress, like TakeError.

func (*SettingsOverlay) TakeError added in v0.3.0

func (s *SettingsOverlay) TakeError() error

TakeError returns and clears the last validation error from a text-edit field. Callers poll this after HandleKeyPress.

func (*SettingsOverlay) View added in v0.3.0

func (s *SettingsOverlay) View() string

View satisfies the Overlay interface.

type TextInputOverlay

type TextInputOverlay struct {
	Title      string
	FocusIndex int // index into focusable stops
	Submitted  bool
	Canceled   bool
	OnSubmit   func()
	// contains filtered or unexported fields
}

TextInputOverlay represents a text input overlay with state management.

func NewTextInputOverlay

func NewTextInputOverlay(title string, initialValue string) *TextInputOverlay

NewTextInputOverlay creates a new text input overlay with the given title and initial value.

func NewTextInputOverlayWithBranchPicker

func NewTextInputOverlayWithBranchPicker(title string, initialValue string, profiles []config.Profile) *TextInputOverlay

NewTextInputOverlayWithBranchPicker creates a text input overlay that includes an empty branch picker. Results are populated asynchronously via SetBranchResults.

func (*TextInputOverlay) BranchFilter

func (t *TextInputOverlay) BranchFilter() string

BranchFilter returns the current filter text from the branch picker.

func (*TextInputOverlay) BranchFilterVersion

func (t *TextInputOverlay) BranchFilterVersion() uint64

BranchFilterVersion returns the current filter version from the branch picker. Returns 0 if no branch picker is present.

func (*TextInputOverlay) GetSelectedBranch

func (t *TextInputOverlay) GetSelectedBranch() string

GetSelectedBranch returns the selected branch name from the branch picker. Returns empty string if no branch picker is present or "New branch" is selected.

func (*TextInputOverlay) GetSelectedProgram

func (t *TextInputOverlay) GetSelectedProgram() string

GetSelectedProgram returns the program string from the selected profile. Returns empty string if no profile picker is present.

func (*TextInputOverlay) GetValue

func (t *TextInputOverlay) GetValue() string

GetValue returns the current value of the text input.

func (*TextInputOverlay) HandleKey

func (t *TextInputOverlay) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface. The branch-filter-change signal surfaced by HandleKeyPress is not lifted into a tea.Cmd here; the host polls BranchFilterVersion() to detect edits and kick off the async search. Callers that care about the filter edge should use HandleKeyPress directly.

func (*TextInputOverlay) HandleKeyPress

func (t *TextInputOverlay) HandleKeyPress(msg tea.KeyPressMsg) (bool, bool)

HandleKeyPress processes a key press and updates the state accordingly. Returns (shouldClose, branchFilterChanged).

func (*TextInputOverlay) Init

func (t *TextInputOverlay) Init() tea.Cmd

Init initializes the text input overlay model

func (*TextInputOverlay) IsCanceled

func (t *TextInputOverlay) IsCanceled() bool

IsCanceled returns whether the form was canceled.

func (*TextInputOverlay) IsSubmitted

func (t *TextInputOverlay) IsSubmitted() bool

IsSubmitted returns whether the form was submitted.

func (*TextInputOverlay) Render

func (t *TextInputOverlay) Render() string

Render renders the text input overlay.

func (*TextInputOverlay) SetBaseBranchName added in v0.13.0

func (t *TextInputOverlay) SetBaseBranchName(name string)

SetBaseBranchName forwards the resolved base branch name to the branch picker for display. No-op when the overlay has no picker.

func (*TextInputOverlay) SetBranchResults

func (t *TextInputOverlay) SetBranchResults(branches []string, version uint64)

SetBranchResults updates the branch picker with search results. version must match the picker's current filterVersion to be accepted.

func (*TextInputOverlay) SetOnSubmit

func (t *TextInputOverlay) SetOnSubmit(onSubmit func())

SetOnSubmit sets a callback function for form submission.

func (*TextInputOverlay) SetSize

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

SetSize resizes the overlay and propagates the inner width to the branch and profile pickers when those pickers are active.

func (*TextInputOverlay) SetValue added in v0.13.0

func (t *TextInputOverlay) SetValue(s string)

SetValue replaces the input text. Used by tests and by any caller that needs to prefill the prompt.

func (*TextInputOverlay) View

func (t *TextInputOverlay) View() string

View renders the model's view

type TextOverlay

type TextOverlay struct {
	// Whether the overlay has been dismissed
	Dismissed bool
	// Callback function to be called when the overlay is dismissed.
	// May return a tea.Cmd for the host to dispatch after the overlay closes.
	OnDismiss func() tea.Cmd
	// contains filtered or unexported fields
}

TextOverlay represents a text screen overlay

func NewTextOverlay

func NewTextOverlay(content string) *TextOverlay

NewTextOverlay creates a new text screen overlay with the given title and content

func (*TextOverlay) HandleKey

func (t *TextOverlay) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface. Delegates to HandleKeyPress, which already returns (closed, cmd).

func (*TextOverlay) HandleKeyPress

func (t *TextOverlay) HandleKeyPress(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKeyPress processes a key press and updates the state. Returns (shouldClose, dismissCmd). dismissCmd is whatever the OnDismiss callback returned (possibly nil) and should be dispatched by the caller.

func (*TextOverlay) Render

func (t *TextOverlay) Render(opts ...WhitespaceOption) string

Render renders the text overlay

func (*TextOverlay) SetSize

func (t *TextOverlay) SetSize(width, _ int)

SetSize satisfies the Overlay interface. TextOverlay uses only width; height is accepted but ignored.

func (*TextOverlay) SetWidth

func (t *TextOverlay) SetWidth(width int)

SetWidth overrides the auto-computed overlay width. Pass 0 to return to content-driven sizing.

func (*TextOverlay) View

func (t *TextOverlay) View() string

View satisfies the Overlay interface.

type WhitespaceOption

type WhitespaceOption func(*whitespace)

WhitespaceOption sets a styling rule for rendering whitespace.

type WorkspacePicker

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

WorkspacePicker is an overlay that lets the user toggle active workspaces. In startup mode, it acts as a single-select picker with a "Global" option. In mid-session mode, it can optionally surface a "Global" row that commits an empty active set, signaling a return to global (no-workspace) mode.

func NewStartupWorkspacePicker

func NewStartupWorkspacePicker(workspaces []config.Workspace) *WorkspacePicker

NewStartupWorkspacePicker creates a single-select workspace picker for startup. Includes a "Global (default)" option at the end.

func NewWorkspacePicker

func NewWorkspacePicker(workspaces []config.Workspace, activeNames map[string]bool, allowGlobal bool) *WorkspacePicker

NewWorkspacePicker creates a workspace picker overlay for toggling active workspaces. activeNames is a set of workspace names that are currently active. When allowGlobal is true, a synthetic "Global (no workspace)" row is appended; selecting it commits an empty active set so the caller can transition the home model back to global mode.

func (*WorkspacePicker) GetActiveWorkspaces

func (w *WorkspacePicker) GetActiveWorkspaces() []config.Workspace

GetActiveWorkspaces returns workspaces that are currently toggled on.

func (*WorkspacePicker) GetSelectedWorkspace

func (w *WorkspacePicker) GetSelectedWorkspace() *config.Workspace

GetSelectedWorkspace returns the workspace selected in startup mode. Returns nil if "Global" is selected or if not in startup mode.

func (*WorkspacePicker) HandleKey

func (w *WorkspacePicker) HandleKey(msg tea.KeyPressMsg) (bool, tea.Cmd)

HandleKey satisfies the Overlay interface. The second bool from HandleKeyPress is reserved for future use and currently always false; HandleKey collapses to (closed, nil).

func (*WorkspacePicker) HandleKeyPress

func (w *WorkspacePicker) HandleKeyPress(msg tea.KeyPressMsg) (bool, bool)

HandleKeyPress processes navigation and toggle/select keys. Returns (committed, _). committed=true means the overlay should close and apply state.

func (*WorkspacePicker) IsStartup

func (w *WorkspacePicker) IsStartup() bool

IsStartup returns whether this is a startup picker.

func (*WorkspacePicker) MarkFailedToLoad added in v0.13.0

func (w *WorkspacePicker) MarkFailedToLoad(names ...string)

MarkFailedToLoad flags names as workspaces that are open but failed to load (the caller's restore failures). They render labelled, with a footer warning: closing one — unchecking it, or picking Global — drops it from the open list, so loom stops retrying it at start. Its live sessions are spared either way: the startup sweep leaves a workspace whose load failed alone.

func (*WorkspacePicker) Render

func (w *WorkspacePicker) Render() string

Render renders the workspace picker overlay.

func (*WorkspacePicker) SetSize

func (w *WorkspacePicker) SetSize(width, _ int)

SetSize satisfies the Overlay interface. WorkspacePicker uses only width; height is accepted but ignored.

func (*WorkspacePicker) SetWidth

func (w *WorkspacePicker) SetWidth(width int)

SetWidth sets the width of the overlay.

func (*WorkspacePicker) View

func (w *WorkspacePicker) View() string

View satisfies the Overlay interface.

Jump to

Keyboard shortcuts

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