ui

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultScrollHeight = 10

DefaultScrollHeight is the default number of visible lines in the scroll view.

Variables

This section is empty.

Functions

This section is empty.

Types

type PickerItem added in v0.4.2

type PickerItem struct {
	Branch string
	Path   string
	Head   string
	IsMain bool
	Repo   string // populated in global mode
}

PickerItem represents a single selectable worktree entry.

type PickerResult added in v0.4.2

type PickerResult struct {
	Items []PickerItem
	Quit  bool // user cancelled without selecting
}

PickerResult holds the outcome of an interactive picker session.

func RunPicker added in v0.4.2

func RunPicker(items []PickerItem, multi bool) (PickerResult, error)

RunPicker launches an interactive terminal picker. If multi is true, users can toggle multiple items with space.

type RepoPickerItem added in v0.4.2

type RepoPickerItem struct {
	Name       string
	Path       string
	Registered bool // already in the registry
}

RepoPickerItem represents a single repo entry in the picker.

type RepoPickerMode added in v0.4.2

type RepoPickerMode int

RepoPickerMode controls the picker's toggle and selection behavior.

const (
	// RepoPickerRegister pre-selects unregistered repos, blocks toggling registered ones.
	RepoPickerRegister RepoPickerMode = iota
	// RepoPickerUnregister shows all repos as toggleable, nothing pre-selected.
	RepoPickerUnregister
)

type RepoPickerResult added in v0.4.2

type RepoPickerResult struct {
	Items []RepoPickerItem
	Quit  bool
}

RepoPickerResult holds the outcome of the repo picker.

func RunRepoPicker added in v0.4.2

func RunRepoPicker(items []RepoPickerItem, mode RepoPickerMode) (RepoPickerResult, error)

RunRepoPicker launches an interactive picker for selecting repos.

type Rerenderer

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

Rerenderer tracks a block of terminal output and can overwrite it in-place using ANSI escape sequences. This enables a "lazy loading" pattern where initial output is displayed immediately and then replaced when updated data becomes available.

func NewRerenderer

func NewRerenderer(out io.Writer) *Rerenderer

NewRerenderer returns a Rerenderer that writes to out.

func (*Rerenderer) Render

func (r *Rerenderer) Render(content string)

Render writes content to the output. On subsequent calls, it moves the cursor up to overwrite the previously rendered block before writing.

type ScrollWriter

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

ScrollWriter wraps an io.Writer and constrains output to a fixed-height scrolling region. When output exceeds the configured height, earlier lines scroll off the top and only the most recent lines remain visible.

func NewScrollWriter

func NewScrollWriter(out io.Writer, maxLines int) *ScrollWriter

NewScrollWriter returns a ScrollWriter that displays at most maxLines of output at a time. If maxLines <= 0, DefaultScrollHeight is used.

func (*ScrollWriter) Flush

func (sw *ScrollWriter) Flush()

Flush writes any remaining partial line and performs a final redraw.

func (*ScrollWriter) Lines

func (sw *ScrollWriter) Lines() int

Lines returns the total number of complete lines received so far.

func (*ScrollWriter) Write

func (sw *ScrollWriter) Write(p []byte) (int, error)

Write implements io.Writer. It buffers incoming bytes, splits on newlines, and redraws the visible scroll region.

Jump to

Keyboard shortcuts

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