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 ¶
- func Edit(id, initial string) tea.Cmd
- func EditorCommand() string
- type Area
- type EditorFinishedMsg
- type Line
- func (l Line) BeforeCursor() string
- func (l *Line) Blur()
- func (l *Line) Focus()
- func (l *Line) ReplaceBeforeCursor(n int, s string)
- func (l *Line) SetSuggestions(values []string)
- func (l *Line) SetValue(s string)
- func (l *Line) SetWidth(w int)
- func (l Line) Suggestions() []string
- func (l *Line) Update(msg tea.Msg) tea.Cmd
- func (l Line) Value() string
- func (l Line) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Edit ¶
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 (Area) BeforeCursor ¶ added in v0.12.0
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
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.
type EditorFinishedMsg ¶
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 (Line) BeforeCursor ¶ added in v0.12.0
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
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 ¶
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 ¶
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 ¶
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 ¶
Suggestions returns the current completion values.