Engine handles all display operations: it refreshes the terminal
interface and stores the necessary offsets of each components. 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. 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. ClearHelpers clears the hint and completion sections below the line. 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. 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. 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. Refresh recomputes and redisplays the entire readline interface, except
the first lines of the primary prompt when the latter is a multiline one. RefreshTransient goes back to the first line of the input buffer
and displays the transient prompt, then redisplays the input line. ResetHelpers cancels all active hints and completions.
func NewEngine(k *core.Keys, s *core.Selection, h *history.Sources, p *ui.Prompt, i *ui.Hint, c *completion.Engine, opts *inputrc.Config) *Engine
func Init(e *Engine, highlighter func([]rune) string)
func WatchResize(eng *Engine) chan<- bool
Package-Level Functions (total 3)
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.
NewEngine is a required constructor for the display engine.
WatchResize redisplays the interface on terminal resize events.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.