Documentation ¶
Index ¶
- func CoordinatesHint(hint *Hint) int
- func DisplayHint(hint *Hint)
- type Hint
- type Prompt
- func (p *Prompt) LastPrint()
- func (p *Prompt) LastUsed() int
- func (p *Prompt) Primary(prompt func() string)
- func (p *Prompt) PrimaryPrint()
- func (p *Prompt) PrimaryUsed() int
- func (p *Prompt) Refreshing() bool
- func (p *Prompt) Right(prompt func() string)
- func (p *Prompt) RightPrint(startColumn int, force bool)
- func (p *Prompt) Secondary(prompt func() string)
- func (p *Prompt) Tooltip(prompt func(word string) string)
- func (p *Prompt) Transient(prompt func() string)
- func (p *Prompt) TransientPrint()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoordinatesHint ¶
CoordinatesHint returns the number of terminal rows used by the hint.
func DisplayHint ¶
func DisplayHint(hint *Hint)
DisplayHint prints the hint (persistent and/or temporary) sections.
Types ¶
type Hint ¶
type Hint struct {
// contains filtered or unexported fields
}
Hint is in charge of printing the usage messages below the input line. Various other UI components have access to it so that they can feed specialized usage messages to it, like completions.
func (*Hint) Len ¶
Len returns the length of the current hint. This is generally used by consumers to know if there already is an active hint, in which case they might want to append to it instead of overwriting it altogether (like in isearch mode).
func (*Hint) Persist ¶
Persist adds a hint message to be persistently displayed until hint.ResetPersist() is called.
func (*Hint) ResetPersist ¶
func (h *Hint) ResetPersist()
ResetPersist drops the persistent hint section.
func (*Hint) Set ¶
Set sets the hint message to the given text. Generally, this hint message will persist until either a command or the completion system overwrites it, or if hint.Reset() is called.
func (*Hint) SetTemporary ¶
SetTemporary sets a hint message that will be cleared at the next keypress or command being run, which generally coincides with the next redisplay.
type Prompt ¶
type Prompt struct {
// contains filtered or unexported fields
}
Prompt stores all prompt rendering/generation functions and is in charge of displaying them, as well as computing their offsets.
func NewPrompt ¶
func NewPrompt(line *core.Line, cursor *core.Cursor, keymaps *keymap.Engine, opts *inputrc.Config) *Prompt
NewPrompt is a required constructor to initialize the prompt system.
func (*Prompt) LastPrint ¶
func (p *Prompt) LastPrint()
LastPrint prints the last line of the primary prompt, if the latter spans on several lines. If not, this function will actually print the entire primary prompt, and PrimaryPrint() will not print anything.
func (*Prompt) LastUsed ¶
LastUsed returns the number of terminal columns used by the last part of the primary prompt (of the entire string if not multiline). This, in effect, returns the X coordinate at which the input line should be printed, and indentation for subsequent lines if several.
func (*Prompt) PrimaryPrint ¶
func (p *Prompt) PrimaryPrint()
PrimaryPrint prints the primary prompt string, excluding the last line if the primary prompt spans on several lines.
func (*Prompt) PrimaryUsed ¶
PrimaryUsed returns the number of terminal rows on which the primary prompt string spans, excluding the last line if it contains newlines.
func (*Prompt) Refreshing ¶
Refreshing returns true if the prompt is currently redisplaying itself (at least the primary prompt), or false if not.
func (*Prompt) RightPrint ¶
RightPrint prints the right-sided prompt strings, which might be either a traditional RPROMPT string, or a tooltip prompt if any must be rendered. If force is true, whatever rprompt or tooltip exists will be printed. If false, only the rprompt, if it exists, will be printed.
func (*Prompt) Secondary ¶
Secondary uses a function returning the prompt to use as the secondary prompt.
func (*Prompt) Transient ¶
Transient uses a function returning the prompt to use as a transient prompt.
func (*Prompt) TransientPrint ¶
func (p *Prompt) TransientPrint()
TransientPrint prints the transient prompt.