input

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTextArea

func NewTextArea(opts ...Option) textarea.Model

NewTextArea creates a textarea.Model with sensible defaults for use inside TUI overlays: no prompt prefix, no line numbers, and dynamic height. The caller should configure styles after creation.

Types

type BodyFetchFunc

type BodyFetchFunc func(index int) (string, error)

BodyFetchFunc fetches the body for an entry at the given index.

type Editor

type Editor struct {
	Submitted bool
	Aborted   bool
	// contains filtered or unexported fields
}

Editor is a Bubble Tea model for editing multiple title+body entries.

func NewEditor

func NewEditor(entries []EditorEntry, opts ...EditorOption) Editor

NewEditor creates an Editor for the given entries.

func (Editor) Init

func (m Editor) Init() tea.Cmd

Init implements tea.Model.

func (Editor) Results

func (m Editor) Results() []EditorResult

Results returns the outcome for all entries.

func (Editor) Update

func (m Editor) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Editor) View

func (m Editor) View() tea.View

View implements tea.Model.

type EditorEntry

type EditorEntry struct {
	Label string // display label (e.g. "owner/repo#123")
	Title string // initial title value
}

EditorEntry defines an item to edit.

type EditorOption

type EditorOption func(*editorConfig)

EditorOption configures an Editor created by NewEditor.

func WithBodyFetch

func WithBodyFetch(fn BodyFetchFunc) EditorOption

WithBodyFetch sets the function used to lazily fetch entry bodies.

func WithEditorBodyMinHeight

func WithEditorBodyMinHeight(h int) EditorOption

WithEditorBodyMinHeight sets the minimum body textarea height.

func WithEditorStyles

func WithEditorStyles(s EditorStyles) EditorOption

WithEditorStyles sets the editor styles.

func WithEditorWidth

func WithEditorWidth(w int) EditorOption

WithEditorWidth sets the editor width.

type EditorResult

type EditorResult struct {
	Label   string
	Title   string
	Body    string
	Changed bool
}

EditorResult holds the outcome for a single edited entry.

func Run

func Run(entries []EditorEntry, opts ...EditorOption) ([]EditorResult, bool, error)

Run launches the editor as a standalone Bubble Tea program and returns results.

type EditorStyles

type EditorStyles struct {
	BlurredText lg.Style
	Counter     lg.Style
	Dirty       lg.Style
	DimLabel    lg.Style
	FocusedText lg.Style
	Header      lg.Style
	HelpKey     lg.Style
	HelpText    lg.Style
	Label       lg.Style
}

EditorStyles controls the visual appearance of the editor.

type Option

type Option func(*config)

Option configures a textarea created by NewTextArea.

func WithMaxHeight

func WithMaxHeight(h int) Option

WithMaxHeight sets the maximum height of the textarea.

func WithMinHeight

func WithMinHeight(h int) Option

WithMinHeight sets the minimum height of the textarea.

func WithPlaceholder

func WithPlaceholder(s string) Option

WithPlaceholder sets the placeholder text shown when the textarea is empty.

func WithWidth

func WithWidth(w int) Option

WithWidth sets the width of the textarea.

Jump to

Keyboard shortcuts

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