Documentation
¶
Overview ¶
Line editor every text field of the toolkit types into, driven by the actions of the text context of the keymap that the prompt answers too
Index ¶
- type Field
- func (f *Field) Action(id string) (tea.Cmd, bool)
- func (f *Field) Cursor() int
- func (f *Field) Empty() bool
- func (f *Field) Insert(text string) bool
- func (f *Field) Line(width int) (string, int)
- func (f *Field) SelectAll()
- func (f *Field) SetCursor(at int)
- func (f *Field) SetValue(text string)
- func (f *Field) Take(msg tea.Msg) bool
- func (f *Field) Value() string
- func (f *Field) Vertical(step int) bool
- func (f *Field) Whole() bool
- func (f *Field) Wrapped(room int) (lines []string, cx, cy int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
// Whether a line break typed or pasted stays one, the newline action breaking the line
Multiline bool
// Whether the text shows as dots
Masked bool
// contains filtered or unexported fields
}
Editable text with a caret, the readline keys of the text context, undo and redo
func (*Field) Action ¶
Carries out an action of the text context, reporting whether the field answers it, with the command it needs such as a clipboard read
func (*Field) Insert ¶
Puts text in at the caret as typed, a selected whole text replaced, reporting whether anything went in
func (*Field) Line ¶
One row of the text in width cells scrolled to keep the caret in view, the caret column in it: the row starts at the first cell from which the text up to the caret is narrower than the width. That text only narrows as cells leave its left, so the cell is found by halving, and the row is made once for each text, caret and width
func (*Field) SelectAll ¶
func (f *Field) SelectAll()
Marks the whole text selected, the next typing replacing it and the next move or delete dropping the mark
func (*Field) SetValue ¶
Replaces the text with the caret at its end, the text it replaced kept on the undo trail
func (*Field) Take ¶
Takes typed text, a paste and the clipboard answer the paste key asked for, reporting whether the text changed
func (*Field) Vertical ¶
Moves the caret a line up or down keeping its column, false when the text has no line there