Documentation
¶
Overview ¶
Package editors contains the editors for the different data types.
Index ¶
- func ConstructEditor(id string, obj any, extraSpec map[string]any, parentEditor *Composite, ...) (edit.Editor, error)
- type Composite
- func (e *Composite) AddQuitCallback(f func())
- func (e *Composite) CreateInputProcessor(cfg input.InputConfig) (input.ModalInputProcessor, error)
- func (e *Composite) EnterField()
- func (e *Composite) GetActiveFieldID() EditorID
- func (e *Composite) GetFieldOrder() []EditorID
- func (e *Composite) GetFields() map[EditorID]edit.Editor
- func (e *Composite) GetID() string
- func (e *Composite) GetStatus() edit.EditorStatus
- func (e *Composite) GetType() string
- func (e *Composite) IsInField() bool
- func (e *Composite) Quit()
- func (e *Composite) SwitchToNextField()
- func (e *Composite) SwitchToPrevField()
- func (e *Composite) Write()
- type EditorID
- type StringEditor
- func (e *StringEditor) AddQuitCallback(f func())
- func (e *StringEditor) AddRune(newRune rune)
- func (e *StringEditor) BackspaceRune()
- func (e *StringEditor) BackspaceToBeginning()
- func (e *StringEditor) Clear()
- func (e *StringEditor) CreateInputProcessor(cfg input.InputConfig) (input.ModalInputProcessor, error)
- func (e *StringEditor) DeleteEverything()
- func (e *StringEditor) DeleteRune()
- func (e *StringEditor) DeleteToEnd()
- func (e StringEditor) GetContent() string
- func (e StringEditor) GetCursorPos() int
- func (e *StringEditor) GetFieldCount() int
- func (e StringEditor) GetID() string
- func (e StringEditor) GetMode() input.TextEditMode
- func (e StringEditor) GetStatus() edit.EditorStatus
- func (e *StringEditor) GetType() string
- func (e *StringEditor) MoveCursorLeft()
- func (e *StringEditor) MoveCursorPastEnd()
- func (e *StringEditor) MoveCursorRight()
- func (e *StringEditor) MoveCursorToBeginning()
- func (e *StringEditor) MoveCursorToEnd()
- func (e *StringEditor) MoveCursorToNextWordBeginning()
- func (e *StringEditor) MoveCursorToNextWordEnd()
- func (e *StringEditor) MoveCursorToPrevWordBeginning()
- func (e *StringEditor) Quit()
- func (e *StringEditor) SetMode(m input.TextEditMode)
- func (e *StringEditor) Write()
- type StringEditorControl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Composite ¶
type Composite struct {
// contains filtered or unexported fields
}
Composite implements Editor
func (*Composite) AddQuitCallback ¶
func (e *Composite) AddQuitCallback(f func())
AddQuitCallback adds a callback that is called when the editor is quit.
func (*Composite) CreateInputProcessor ¶ added in v0.9.8
func (e *Composite) CreateInputProcessor(cfg input.InputConfig) (input.ModalInputProcessor, error)
CreateInputProcessor creates an input processor for the editor.
func (*Composite) EnterField ¶
func (e *Composite) EnterField()
EnterField changes the editor to enter the currently selected field, e.g. such that input processing is deferred to the field.
func (*Composite) GetActiveFieldID ¶ added in v0.9.8
GetActiveFieldID returns the ID of the currently active field.
func (*Composite) GetFieldOrder ¶ added in v0.9.8
GetFieldOrder returns the order of the fields.
func (*Composite) GetFields ¶ added in v0.9.8
GetFields returns the subeditors of this composite editor.
func (*Composite) GetStatus ¶ added in v0.9.8
func (e *Composite) GetStatus() edit.EditorStatus
GetStatus informs on whether the editor is active and focussed.
"active" here means that the editor is in use, i.e. the user is currently editing within the editor. "focussed" means that the editor is the one currently receiving input, i.e. that it is the "lowestmost" active editor.
E.g. when there is merely a single string editor, it must be active and focused. E.g. when there is a composite editor it must be active but the focus may lie with it or with a child editor.
func (*Composite) IsInField ¶ added in v0.9.8
IsInField informs on whether the editor is currently in a field.
func (*Composite) Quit ¶
func (e *Composite) Quit()
Quit quits all subeditors and calls the quit callback.
func (*Composite) SwitchToNextField ¶
func (e *Composite) SwitchToNextField()
SwitchToNextField switches to the next field (wrapping araound, if necessary)
func (*Composite) SwitchToPrevField ¶
func (e *Composite) SwitchToPrevField()
SwitchToPrevField switches to the previous field (wrapping araound, if necessary)
type EditorID ¶ added in v0.9.8
type EditorID = string
An EditorID is a unique identifier for an editor within a composite editor.
type StringEditor ¶
type StringEditor struct {
ID string
Content string
CursorPos int
Mode input.TextEditMode
StatusFn func() edit.EditorStatus
QuitCallback func()
CommitFn func(string)
// contains filtered or unexported fields
}
StringEditor ...
func (*StringEditor) AddQuitCallback ¶
func (e *StringEditor) AddQuitCallback(f func())
AddQuitCallback adds a callback that is called when the editor is quit.
func (*StringEditor) AddRune ¶
func (e *StringEditor) AddRune(newRune rune)
AddRune adds a rune at the cursor position.
func (*StringEditor) BackspaceRune ¶
func (e *StringEditor) BackspaceRune()
BackspaceRune deletes the rune before the cursor position.
func (*StringEditor) BackspaceToBeginning ¶
func (e *StringEditor) BackspaceToBeginning()
BackspaceToBeginning deletes all runes before the cursor position.
func (*StringEditor) CreateInputProcessor ¶ added in v0.9.8
func (e *StringEditor) CreateInputProcessor(cfg input.InputConfig) (input.ModalInputProcessor, error)
CreateInputProcessor creates an input processor for the editor.
func (*StringEditor) DeleteEverything ¶ added in v0.9.11
func (e *StringEditor) DeleteEverything()
DeleteEverything deletes all runes in the editor.
func (*StringEditor) DeleteRune ¶
func (e *StringEditor) DeleteRune()
DeleteRune deletes the rune at the cursor position.
func (*StringEditor) DeleteToEnd ¶
func (e *StringEditor) DeleteToEnd()
DeleteToEnd deletes all runes after the cursor position.
func (StringEditor) GetContent ¶
func (e StringEditor) GetContent() string
GetContent returns the current (edited) contents.
func (StringEditor) GetCursorPos ¶
func (e StringEditor) GetCursorPos() int
GetCursorPos returns the current cursor position in the string, 0 being
func (*StringEditor) GetFieldCount ¶
func (e *StringEditor) GetFieldCount() int
func (StringEditor) GetID ¶ added in v0.9.8
func (e StringEditor) GetID() string
GetID returns the ID of the editor.
func (StringEditor) GetMode ¶
func (e StringEditor) GetMode() input.TextEditMode
GetMode returns the current mode of the editor.
func (StringEditor) GetStatus ¶ added in v0.9.8
func (e StringEditor) GetStatus() edit.EditorStatus
GetStatus ...
func (*StringEditor) GetType ¶ added in v0.9.7
func (e *StringEditor) GetType() string
GetType asserts that this is a string editor.
func (*StringEditor) MoveCursorLeft ¶
func (e *StringEditor) MoveCursorLeft()
MoveCursorLeft moves the cursor one rune to the left.
func (*StringEditor) MoveCursorPastEnd ¶
func (e *StringEditor) MoveCursorPastEnd()
MoveCursorPastEnd moves the cursor past the end of the string.
func (*StringEditor) MoveCursorRight ¶
func (e *StringEditor) MoveCursorRight()
MoveCursorRight moves the cursor one rune to the right.
func (*StringEditor) MoveCursorToBeginning ¶
func (e *StringEditor) MoveCursorToBeginning()
MoveCursorToBeginning moves the cursor to the beginning of the string.
func (*StringEditor) MoveCursorToEnd ¶
func (e *StringEditor) MoveCursorToEnd()
MoveCursorToEnd moves the cursor to the end of the string.
func (*StringEditor) MoveCursorToNextWordBeginning ¶ added in v0.9.8
func (e *StringEditor) MoveCursorToNextWordBeginning()
MoveCursorToNextWordBeginning moves the cursor one rune to the right, or to the end of the string if already at the end.
func (*StringEditor) MoveCursorToNextWordEnd ¶ added in v0.9.8
func (e *StringEditor) MoveCursorToNextWordEnd()
MoveCursorToNextWordEnd moves the cursor to the end of the next word.
func (*StringEditor) MoveCursorToPrevWordBeginning ¶ added in v0.9.8
func (e *StringEditor) MoveCursorToPrevWordBeginning()
MoveCursorToPrevWordBeginning moves the cursor one rune to the left, or to the beginning of the string if already at the beginning.
func (*StringEditor) SetMode ¶
func (e *StringEditor) SetMode(m input.TextEditMode)
SetMode sets the current mode of the editor.
func (*StringEditor) Write ¶
func (e *StringEditor) Write()
Write commits the current contents of the editor.
type StringEditorControl ¶
type StringEditorControl interface {
SetMode(m input.TextEditMode)
DeleteRune()
BackspaceRune()
BackspaceToBeginning()
DeleteToEnd()
Clear()
MoveCursorToBeginning()
MoveCursorToEnd()
MoveCursorPastEnd()
MoveCursorLeft()
MoveCursorRight()
MoveCursorToNextWordBeginning()
MoveCursorToPrevWordBeginning()
MoveCursorToNextWordEnd()
AddRune(newRune rune)
}
StringEditorControl allows manipulation of a string editor.