input

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package input is the TUI's shared text-entry substrate: thin themed wrappers over bubbles/textinput and textarea, plus the external-editor hop. Every prompt in the dashboard (filter, JQL, action verbs) goes through here, so cursor movement, word-wise editing and bracketed paste behave identically everywhere — replacing the hand-rolled append-only buffers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Edit

func Edit(id, initial string) tea.Cmd

Edit suspends the TUI and opens the external editor on a temp file seeded with initial; the result returns as an EditorFinishedMsg. The editor value runs through the shell so commands with flags ("nvim -f") work.

func EditorCommand

func EditorCommand() string

EditorCommand returns the configured external editor: $JIRA_EDITOR wins, $EDITOR is the fallback, "" means none — multiline fields then use the in-TUI textarea instead. One rule, no per-field knobs.

Types

type Area

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

Area is a multiline input, the in-TUI fallback when no external editor is configured. The zero value is not usable; construct with NewArea.

func NewArea

func NewArea(placeholder string, width, height int) Area

NewArea builds a focused multiline input sized for a modal.

func (Area) BeforeCursor added in v0.12.0

func (a Area) BeforeCursor() string

BeforeCursor returns the current logical line up to the cursor, for token detection. Words never span newlines, so one line is the whole search space.

func (*Area) Blur added in v0.12.0

func (a *Area) Blur()

Blur removes focus (the cursor stops rendering).

func (*Area) Focus added in v0.12.0

func (a *Area) Focus()

Focus and Blur hand keyboard ownership to or away from the area, for forms where two inputs share one modal.

func (*Area) ReplaceBeforeCursor added in v0.12.0

func (a *Area) ReplaceBeforeCursor(n int, s string)

ReplaceBeforeCursor swaps the n runes before the cursor for s. The textarea exposes no direct cursor repositioning after SetValue, so the cursor lands at the end of the buffer — exact for the dominant case of completing while typing at the end, approximate for a mid-text edit.

func (*Area) SetValue

func (a *Area) SetValue(s string)

SetValue replaces the content (e.g. reopening a draft).

func (*Area) Update

func (a *Area) Update(msg tea.Msg) tea.Cmd

Update routes a message into the textarea (enter inserts a newline).

func (Area) Value

func (a Area) Value() string

Value returns the current content.

func (Area) View

func (a Area) View() string

View renders the textarea.

type EditorFinishedMsg

type EditorFinishedMsg struct {
	ID   string
	Text string
	Err  error
}

EditorFinishedMsg delivers the text written in the external editor. ID is the opener's routing tag (e.g. "comment:JCT-12") so the consumer knows which flow to resume. Err is set when the editor could not run or the buffer could not be read back.

type Line

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

Line is a single-line input. The zero value is not usable; construct with NewLine.

func NewLine

func NewLine(prompt, placeholder string) Line

NewLine builds a focused single-line input with the given prompt and placeholder.

func (Line) BeforeCursor added in v0.12.0

func (l Line) BeforeCursor() string

BeforeCursor returns the content up to the cursor, for token detection (e.g. an autocomplete trigger word being typed).

func (*Line) Blur added in v0.12.0

func (l *Line) Blur()

Blur removes focus (the cursor stops rendering).

func (*Line) Focus added in v0.12.0

func (l *Line) Focus()

Focus and Blur hand keyboard ownership to or away from the field, for forms where two inputs share one modal.

func (*Line) ReplaceBeforeCursor added in v0.12.0

func (l *Line) ReplaceBeforeCursor(n int, s string)

ReplaceBeforeCursor swaps the n runes before the cursor for s, leaving the cursor at the end of s — how an autocomplete acceptance lands.

func (*Line) SetSuggestions

func (l *Line) SetSuggestions(values []string)

SetSuggestions enables ghost-text autocompletion over the given values: typing a prefix shows the rest faint, and the textinput's accept binding (tab / ctrl+e / right at end) completes it.

func (*Line) SetValue

func (l *Line) SetValue(s string)

SetValue replaces the content and moves the cursor to the end (the natural spot when prefilling, e.g. the current summary for an edit).

func (*Line) SetWidth

func (l *Line) SetWidth(w int)

SetWidth makes the field render exactly w columns, clamped to at least one so a too-narrow pane can never push a negative width into the textinput (which panics on View). textinput.View draws one column wider than its set width — a trailing cell for the end-of-line cursor — so the set width is one less than w; a boxed caller budgets exactly w and the field fills it without overrunning the frame.

func (Line) Suggestions

func (l Line) Suggestions() []string

Suggestions returns the current completion values.

func (*Line) Update

func (l *Line) Update(msg tea.Msg) tea.Cmd

Update routes a message (keys, paste) into the input.

func (Line) Value

func (l Line) Value() string

Value returns the current content.

func (Line) View

func (l Line) View() string

View renders the input with its cursor.

Jump to

Keyboard shortcuts

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