term

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 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

View Source
var ColumnNum int

Functions

func ClearLine added in v0.0.15

func ClearLine()

func CloseProps added in v0.0.15

func CloseProps()

func ColorBlue added in v0.0.15

func ColorBlue()

func ColorBold added in v0.0.15

func ColorBold()

func ColorBrGreen added in v0.0.15

func ColorBrGreen()

func ColorCyan added in v0.0.15

func ColorCyan()

func ColorGreen added in v0.0.15

func ColorGreen()

func ColorMagenta added in v0.0.15

func ColorMagenta()

func ColorOrange added in v0.0.15

func ColorOrange()

func ColorRed added in v0.0.15

func ColorRed()

func ColorWhite added in v0.0.15

func ColorWhite()

func CurDown added in v0.0.15

func CurDown(n int)

func CurLeft added in v0.0.15

func CurLeft(n int)

func CurRight added in v0.0.15

func CurRight(n int)

func CurUp added in v0.0.15

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)

DisplayDict is dummy non-implementation for wasm for display builtin

func DisplaySpreadsheetRow

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

DisplaySpreadsheetRow is dummy non-implementation for wasm for display builtin

func DisplayTable

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

DisplayTable is dummy non-implementation for wasm for display builtin

func GetTerminalColumns added in v0.0.26

func GetTerminalColumns() int

func HideCur added in v0.0.15

func HideCur()

func ResetBold added in v0.0.15

func ResetBold()

func RestoreCurPos added in v0.0.15

func RestoreCurPos()

func RyeHighlight added in v0.0.26

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

func SaveCurPos

func SaveCurPos()

func SetSB added in v0.0.15

func SetSB(fn func(string))

func SetTerminalColumns added in v0.0.27

func SetTerminalColumns(c int)

func ShowCur added in v0.0.15

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) SetColumns added in v0.0.27

func (s *MLState) SetColumns(cols int) bool

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