display

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 17 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) AcceptInline added in v1.3.0

func (e *Engine) AcceptInline(line *core.Line, cursor *core.Cursor) bool

AcceptInline replaces the line buffer with the inline suggestion when one applies at the cursor, clears the suggestion, and reports whether it did so. Callers pass the line/cursor to accept onto, since the engine's own line may point at a minibuffer during completion or search.

func (*Engine) AcceptInlineWord added in v1.3.0

func (e *Engine) AcceptInlineWord(line *core.Line, cursor *core.Cursor)

AcceptInlineWord accepts the next word of the inline suggestion, leaving the rest as a suggestion. It follows forward-word semantics: any leading whitespace plus the following run of non-whitespace runes are inserted.

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) ClearInlineSuggestion added in v1.3.0

func (e *Engine) ClearInlineSuggestion()

ClearInlineSuggestion clears the current inline suggestion.

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) GetInlineSuggestion added in v1.3.0

func (e *Engine) GetInlineSuggestion() string

GetInlineSuggestion returns the current inline suggestion.

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.

func (*Engine) SetInlineSuggestion added in v1.3.0

func (e *Engine) SetInlineSuggestion(suggestion string)

SetInlineSuggestion sets a suggestion to display after the cursor.

Jump to

Keyboard shortcuts

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