Documentation
¶
Overview ¶
Package composer is the multi-line message input plus a slash-command completion list and an @-mention file picker.
Package composer - mention.go: @ workspace-mention menu.
A mention is a workspace entity (file, symbol, session) the user inserts by typing "@" at any token boundary. It shares the same menu scaffold as slash completion but uses different trigger logic and a different candidate list.
Index ¶
- type Command
- type Mention
- type Model
- func (m Model) AcceptCommonPrefix() (Model, bool)
- func (m Model) AcceptMention() Model
- func (m Model) AcceptSelected() Model
- func (m *Model) Blur()
- func (m *Model) Clear()
- func (m *Model) ClearSelection()
- func (m *Model) ClickToColumn(x int)
- func (m Model) Commands() []Command
- func (m Model) CursorLine() int
- func (m *Model) Focus()
- func (m Model) Framed() bool
- func (m Model) HasSelection() bool
- func (m Model) Height() int
- func (m Model) InputColumnOffset() int
- func (m Model) InputRowFromBottom() int
- func (m Model) IsEmpty() bool
- func (m Model) MentionMenuActive() bool
- func (m Model) MentionMenuDismiss() Model
- func (m Model) MentionMenuNext() Model
- func (m Model) MentionMenuPrev() Model
- func (m Model) Mentions() []Mention
- func (m Model) MenuActive() bool
- func (m *Model) MenuClickRow(row int) bool
- func (m Model) MenuDismiss() Model
- func (m Model) MenuNext() Model
- func (m Model) MenuPrev() Model
- func (m Model) MenuRows() int
- func (m Model) SelectedText() string
- func (m Model) Selection() sel.Selection
- func (m Model) SelectionRect() sel.Rect
- func (m *Model) SetCommands(cmds []Command)
- func (m *Model) SetMentions(mentions []Mention)
- func (m *Model) SetSelection(s sel.Selection)
- func (m *Model) SetSelectionRect(r sel.Rect)
- func (m *Model) SetTheme(t theme.Theme, tier theme.Tier)
- func (m *Model) SetValue(s string)
- func (m *Model) SetWidth(width int)
- func (m Model) SubmitText() string
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) Value() string
- func (m Model) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mention ¶
Mention is one workspace entity the user may reference via "@". Path is the workspace-relative path that gets inserted into the text. Display is the label shown in the picker (may equal Path).
type Model ¶
Model wraps bubbles/v2 textarea for the multi-line input, the slash-completion menu, and the @-mention picker.
Dynamic height: the textarea grows from 1 line to maxInputLines as the user types, and shrinks when lines are removed. The frame around the input always occupies a fixed gutter (top and bottom border rows) so the rest of the cockpit layout never reflows (ux-rules.md rule 2.7, 2.8).
func (Model) AcceptCommonPrefix ¶
AcceptCommonPrefix extends the slash-command input by the longest shared prefix.
func (Model) AcceptMention ¶
AcceptMention replaces the "@query" fragment with the selected mention path.
func (Model) AcceptSelected ¶
AcceptSelected replaces the input with the highlighted slash-command.
func (*Model) ClearSelection ¶ added in v0.1.2
func (m *Model) ClearSelection()
ClearSelection drops any selection and its highlight.
func (*Model) ClickToColumn ¶
ClickToColumn places the cursor under a click at display column x of the composer's first row. The prompt occupies the first promptWidth columns.
func (Model) CursorLine ¶
CursorLine returns the current line index (0-based) of the cursor.
func (Model) Framed ¶ added in v0.1.2
Framed reports whether View draws the themed border around the body. The owning screen uses it for selection-region geometry: border rows are not selectable.
func (Model) HasSelection ¶ added in v0.1.2
HasSelection reports whether a selection is active.
func (Model) Height ¶
Height is the total row count View draws. It is: border-top(1) + textarea-rows (dynamic 1–maxInputLines) + border-bottom(1) + completion-menu-rows (when open). Below minFramedWidth the border is omitted, so height equals textarea-rows + menu-rows.
func (Model) InputColumnOffset ¶
InputColumnOffset is how many display columns the left border and padding put before the prompt. Mouse clicks subtract it to land on the input's own column space.
func (Model) InputRowFromBottom ¶
InputRowFromBottom is how many rows above the screen's status row the top input line sits (for mouse routing). When framed, the bottom border is 1 row above the status row, so the input is 2 above. When bare, the input is 1 above.
func (Model) MentionMenuActive ¶
MentionMenuActive reports whether the @-mention picker is showing.
func (Model) MentionMenuDismiss ¶
MentionMenuDismiss closes the @-mention picker without changing the text.
func (Model) MentionMenuNext ¶
MentionMenuNext / MentionMenuPrev move the highlighted row in the mention picker.
func (Model) MentionMenuPrev ¶
func (Model) MenuActive ¶
MenuActive reports whether the slash-command completion menu is showing.
func (*Model) MenuClickRow ¶
MenuClickRow accepts the completion row at rendered index row (0 = top). Returns false when the menu is closed or the row is out of range.
func (Model) MenuDismiss ¶
MenuDismiss closes the slash-command menu without changing the text.
func (Model) MenuRows ¶
MenuRows returns the row count the active completion or mention menu occupies (0 when closed).
func (Model) SelectedText ¶ added in v0.1.2
SelectedText returns the plain stream text between anchor and focus, computed from the input value itself (never from a rendered string), wrapped into display rows aligned column-for-column with what View draws. Empty when inactive or when the text changed mid-drag.
func (Model) Selection ¶ added in v0.1.2
Selection reports the current selection, including the armed anchor.
func (Model) SelectionRect ¶ added in v0.1.2
SelectionRect returns the body region's current absolute screen rect.
func (*Model) SetCommands ¶
SetCommands sets the slash-completion candidate list.
func (*Model) SetMentions ¶
SetMentions sets the workspace-entity candidate list for the @-picker. The caller (the conversation screen or demo harness) builds this list; the composer holds no filesystem access.
func (*Model) SetSelection ¶ added in v0.1.2
SetSelection records the live drag selection in body-local cells. A text change invalidates: Update's value-comparison arm drops any selection whose armed value no longer matches, so a stale anchor can never copy drifted text.
func (*Model) SetSelectionRect ¶ added in v0.1.2
SetSelectionRect records the body rect. The owning screen calls it wherever it lays out the composer.
func (Model) SubmitText ¶
SubmitText returns the text to send: strips a trailing backslash-newline escape used for portable multi-line entry (ux-rules.md rule 4.3).