Documentation ¶
Index ¶
- func Init(e *Engine, highlighter func([]rune) string)
- func WatchResize(eng *Engine) chan<- bool
- type Engine
- func (e *Engine) AcceptLine()
- func (e *Engine) AvailableHelperLines() int
- func (e *Engine) ClearHelpers()
- func (e *Engine) CursorBelowLine()
- func (e *Engine) CursorToLineStart()
- func (e *Engine) PrintPrimaryPrompt()
- func (e *Engine) Refresh()
- func (e *Engine) RefreshTransient()
- func (e *Engine) ResetHelpers()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init computes some base coordinates needed before displaying the line and helpers. The shell syntax highlighter is also provided here, since any consumer library will have bound it after instantiating a new shell instance.
func WatchResize ¶
WatchResize redisplays the interface on terminal resize events.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine handles all display operations: it refreshes the terminal interface and stores the necessary offsets of each components.
func NewEngine ¶
func NewEngine(k *core.Keys, s *core.Selection, h *history.Sources, p *ui.Prompt, i *ui.Hint, c *completion.Engine, opts *inputrc.Config) *Engine
NewEngine is a required constructor for the display engine.
func (*Engine) AcceptLine ¶
func (e *Engine) AcceptLine()
AcceptLine redraws the current UI when the line has been accepted and returned to the caller. After clearing various things such as hints, completions and some right prompts, the shell will put the display at the start of the line immediately following the line.
func (*Engine) AvailableHelperLines ¶
AvailableHelperLines returns the number of lines available below the hint section. It returns half the terminal space if we currently have less than 1/3rd of it below.
func (*Engine) ClearHelpers ¶
func (e *Engine) ClearHelpers()
ClearHelpers clears the hint and completion sections below the line.
func (*Engine) CursorBelowLine ¶
func (e *Engine) CursorBelowLine()
CursorBelowLine moves the cursor to the leftmost column of the first row after the last line of input. This function should only be called when the cursor is on its "cursor" position on the input line.
func (*Engine) CursorToLineStart ¶
func (e *Engine) CursorToLineStart()
CursorToLineStart moves the cursor just after the primary prompt. This function should only be called when the cursor is on its "cursor" position on the input line.
func (*Engine) PrintPrimaryPrompt ¶
func (e *Engine) PrintPrimaryPrompt()
PrintPrimaryPrompt redraws the primary prompt. There are relatively few cases where you want to use this. It is currently only used when using clear-screen commands.
func (*Engine) Refresh ¶
func (e *Engine) Refresh()
Refresh recomputes and redisplays the entire readline interface, except the first lines of the primary prompt when the latter is a multiline one.
func (*Engine) RefreshTransient ¶
func (e *Engine) RefreshTransient()
RefreshTransient goes back to the first line of the input buffer and displays the transient prompt, then redisplays the input line.
func (*Engine) ResetHelpers ¶
func (e *Engine) ResetHelpers()
ResetHelpers cancels all active hints and completions.