ui

package
v0.0.0-...-8aadb99 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoordinatesHint

func CoordinatesHint(hint *Hint) int

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

func (h *Hint) Len() int

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

func (h *Hint) Persist(hint string)

Persist adds a hint message to be persistently displayed until hint.ResetPersist() is called.

func (*Hint) Reset

func (h *Hint) Reset()

Reset removes the hint message.

func (*Hint) ResetPersist

func (h *Hint) ResetPersist()

ResetPersist drops the persistent hint section.

func (*Hint) Set

func (h *Hint) Set(hint string)

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

func (h *Hint) SetTemporary(hint string)

SetTemporary sets a hint message that will be cleared at the next keypress or command being run, which generally coincides with the next redisplay.

func (*Hint) Text

func (h *Hint) Text() string

Text returns the current hint text.

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

func (p *Prompt) LastUsed() int

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) Primary

func (p *Prompt) Primary(prompt func() string)

Primary uses a function returning the string to use as the primary prompt.

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

func (p *Prompt) PrimaryUsed() int

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

func (p *Prompt) Refreshing() bool

Refreshing returns true if the prompt is currently redisplaying itself (at least the primary prompt), or false if not.

func (*Prompt) Right

func (p *Prompt) Right(prompt func() string)

Right uses a function returning the string to use as the right prompt.

func (*Prompt) RightPrint

func (p *Prompt) RightPrint(startColumn int, force bool)

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

func (p *Prompt) Secondary(prompt func() string)

Secondary uses a function returning the prompt to use as the secondary prompt.

func (*Prompt) Tooltip

func (p *Prompt) Tooltip(prompt func(word string) string)

Tooltip uses a function returning the prompt to use as a tooltip prompt.

func (*Prompt) Transient

func (p *Prompt) Transient(prompt func() string)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL