term

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const HistoryLimit = 1000

HistoryLimit is the maximum number of entries saved in the scrollback history.

Variables

This section is empty.

Functions

func ClearLine

func ClearLine()

func CloseProps

func CloseProps()

func ColorBlue

func ColorBlue()

func ColorBold

func ColorBold()

func ColorBrGreen

func ColorBrGreen()

func ColorCyan

func ColorCyan()

func ColorGreen

func ColorGreen()

func ColorMagenta

func ColorMagenta()

func ColorOrange

func ColorOrange()

func ColorRed

func ColorRed()

func ColorWhite

func ColorWhite()

func CurDown

func CurDown(n int)

func CurLeft

func CurLeft(n int)

func CurRight

func CurRight(n int)

func CurUp

func CurUp(n int)

func DisplayBlock

func DisplayBlock(bloc env.Block, idx *env.Idxs) (env.Object, bool)

func DisplayDict

func DisplayDict(bloc env.Dict, idx *env.Idxs) (env.Object, bool)

func DisplayInputField

func DisplayInputField(right int, mlen int) (env.Object, bool)

func DisplaySelection

func DisplaySelection(bloc env.Block, idx *env.Idxs, right int) (env.Object, bool)

func DisplaySpreadsheetRow

func DisplaySpreadsheetRow(bloc env.SpreadsheetRow, idx *env.Idxs) (env.Object, bool)

func DisplayTable

func DisplayTable(bloc env.Spreadsheet, idx *env.Idxs) (env.Object, bool)

func GetChar

func GetChar() (ascii int, keyCode int, err error)

func GetChar2

func GetChar2() (letter string, ascii int, keyCode int, err error)

func GetTerminalColumns added in v0.0.26

func GetTerminalColumns() int

func HideCur

func HideCur()

func ResetBold

func ResetBold()

func RestoreCurPos

func RestoreCurPos()

func RyeHighlight added in v0.0.26

func RyeHighlight(s string, inStrX bool, columns int) (string, bool)

func RyeHighlight_OLD1 added in v0.0.26

func RyeHighlight_OLD1(s string, inStrX bool) (string, bool)

func SaveCurPos

func SaveCurPos()

func ShowCur

func ShowCur()

Types

type Completer added in v0.0.26

type Completer func(line string, mode int) []string

Completer takes the currently edited line content at the left of the cursor to the completer which may return {"Hello, world", "Hello, Word"} to have "Hello, world!!!".

type HighlightedStringBuilder added in v0.0.26

type HighlightedStringBuilder struct {
	// contains filtered or unexported fields
}

func (*HighlightedStringBuilder) ColoredString added in v0.0.26

func (h *HighlightedStringBuilder) ColoredString(inStr bool) string

func (*HighlightedStringBuilder) Reset added in v0.0.26

func (h *HighlightedStringBuilder) Reset()

func (*HighlightedStringBuilder) String added in v0.0.26

func (h *HighlightedStringBuilder) String() string

func (*HighlightedStringBuilder) WriteRune added in v0.0.26

func (h *HighlightedStringBuilder) WriteRune(c rune)

type KeyEvent added in v0.0.26

type KeyEvent struct {
	Key   string
	Code  int
	Ctrl  bool
	Alt   bool
	Shift bool
}

func NewKeyEvent added in v0.0.26

func NewKeyEvent(key string, code int, ctrl bool, alt bool, shift bool) KeyEvent

type MLState added in v0.0.26

type MLState struct {
	// contains filtered or unexported fields
}

State represents an open terminal

func NewMicroLiner added in v0.0.26

func NewMicroLiner(ch chan KeyEvent, sb func(msg string), el func(line string) string) *MLState

NewLiner initializes a new *State, and sets the terminal into raw mode. To restore the terminal to its previous state, call State.Close().

func (*MLState) AppendHistory added in v0.0.26

func (s *MLState) AppendHistory(item string)

AppendHistory appends an entry to the scrollback history. AppendHistory should be called iff Prompt returns a valid command.

func (*MLState) ClearHistory added in v0.0.26

func (s *MLState) ClearHistory()

ClearHistory clears the scrollback history.

func (*MLState) MicroPrompt added in v0.0.26

func (s *MLState) MicroPrompt(prompt string, text string, pos int, ctx1 context.Context) (string, error)

signals end-of-file by pressing Ctrl-D.

func (*MLState) SetCompleter added in v0.0.26

func (s *MLState) SetCompleter(f Completer)

SetCompleter sets the completion function that Liner will call to fetch completion candidates when the user presses tab.

type WordCompleter added in v0.0.26

type WordCompleter func(line string, pos int, mode int) (head string, completions []string, tail string)

WordCompleter takes the currently edited line with the cursor position and to the completer which may returns ("Hello, ", {"world", "Word"}, "!!!") to have "Hello, world!!!".

Jump to

Keyboard shortcuts

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