overlay

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: AGPL-3.0 Imports: 21 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 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) 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 six rows: Remote Control, Permission Mode, Model, Headroom Proxy, Effort, and Cache TTL (1h).

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 LaunchOptions added in v0.5.0

type LaunchOptions struct {
	RemoteControl  bool
	PermissionMode string
	Model          string
	HeadroomProxy  bool
	Effort         string
	CacheTTL1h     bool
}

LaunchOptions holds the six per-session launch toggles. Defined here (rather than in app) so it's usable both by SessionLaunchOptions (ephemeral, edited as a plain value) and by app's launch-command composition, without an import cycle back to app.

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 an *session.Instance 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 four types that satisfy this interface today are TextInputOverlay, TextOverlay, ConfirmationOverlay, and WorkspacePicker. 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) 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) 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) SetSize added in v0.3.0

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

SetSize satisfies the Overlay interface.

func (*SettingsOverlay) TakeError added in v0.3.0

func (s *SettingsOverlay) TakeError() error

TakeError returns and clears the last validation error (currently only possible from the Daemon Poll Interval 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) 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) 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) 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