Documentation
¶
Overview ¶
Package input owns the v2 TUI's bottom textarea: prompt composition, paste compaction, and history navigation.
The Input is a tea.Model-ish wrapper around bubbles/textarea that adds three behaviors not in the underlying widget:
Bracketed-paste compaction. Multi-line or >200-char pastes are stored in an internal buffer and replaced with a compact placeholder so the input box stays readable. On submit, placeholders are swapped back to raw content (agent-facing) or to bracketed paste chips (view-facing).
Prompt history. Submitted prompts are pushed to a history stack; Up/Down walks back/forward through them. The user's in-progress draft is preserved when nav engages and restored when nav exits past the newest entry.
Submission. The App routes Enter through Input.Submit, which returns the two prompt forms (for-agent / for-view) plus a boolean indicating "this is a real submission, not an empty line". The App decides what to do next — start a Run, intercept a slash command, or queue mid-run.
Index ¶
- type Input
- func (i *Input) BlinkCmd() tea.Cmd
- func (i *Input) Blur()
- func (i *Input) Empty() bool
- func (i *Input) Focus() tea.Cmd
- func (i *Input) Reset()
- func (i *Input) SetValue(s string)
- func (i *Input) SetWidth(w int)
- func (i *Input) Update(msg tea.Msg) tea.Cmd
- func (i *Input) Value() string
- func (i *Input) View() string
- type SubmitMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
Input is the textarea wrapper. Construct with New; mount in the App's layout slot. The App calls Update to feed it tea.Msg values and View to render it.
func New ¶
New constructs an Input with v1-matching styling. The caller is responsible for calling SetWidth on every WindowSizeMsg and Focus when the input is the active focus.
func (*Input) BlinkCmd ¶
Cursor's blink command — re-exposed so the App can include it in its initial tea.Batch.
func (*Input) Focus ¶
Focus / Blur — Wrap the textarea's focus methods so the App's focus stack can drive them.
func (*Input) Reset ¶
func (i *Input) Reset()
Reset clears the textarea and the paste buffer. Called after a successful submission.
func (*Input) SetWidth ¶
SetWidth updates the textarea's visible column count. Called on every WindowSizeMsg by the App.
func (*Input) Update ¶
Update routes a tea.Msg through the input. Returns a tea.Cmd that the App should chain. Special keys (Enter on non-empty, Up/Down for history, bracketed-paste) are consumed here; every other key falls through to the textarea.
Returning a tea.Cmd that emits a SubmitMsg is how submission signals up to the App — keeps the App's Update loop the single place that owns "start a run" semantics.
type SubmitMsg ¶
type SubmitMsg struct {
// ForAgent is the prompt the agent sees: raw paste content
// inlined, no markers. Byte-for-byte what the user composed.
ForAgent string
// ForView is the transcript-facing form: paste blocks wrapped
// in visible chips so the scrollback shows where each paste
// starts and ends.
ForView string
}
SubmitMsg is dispatched as a tea.Cmd return when the user presses Enter with non-empty content. The App handles this message: routes slash commands, queues mid-run prompts, or starts a fresh Run.