display

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(e *Engine, highlighter func([]rune) string)

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

func WatchResize(eng *Engine) chan<- bool

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

func (e *Engine) AvailableHelperLines() int

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.

Jump to

Keyboard shortcuts

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