readline

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PROMPT_MARK = "\x1b]133;"
View Source
const ST = "\x1b\\"

Variables

View Source
var ErrAcceptInput = errors.New("Accept input")
View Source
var ErrCouldNotPerformAction = errors.New("Could not perform the specified action")

Functions

func MarkOutputStart

func MarkOutputStart() string

Types

type CompleterFunction

type CompleterFunction = func(before_cursor, after_cursor string) *cli.Completions

type History

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

func NewHistory

func NewHistory(path string, max_items int) *History

func (*History) AddItem

func (self *History) AddItem(cmd string, duration time.Duration)

func (*History) Read

func (self *History) Read()

func (*History) Shutdown

func (self *History) Shutdown()

func (*History) Write

func (self *History) Write()

type HistoryItem

type HistoryItem struct {
	Cmd       string        `json:"cmd"`
	Cwd       string        `json:"cwd,omitempty"`
	Timestamp time.Time     `json:"timestamp"`
	Duration  time.Duration `json:"duration,omitempty"`
	ExitCode  int           `json:"exit_code"`
}

type HistoryMatches

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

type HistorySearch

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

type InputState

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

type KeyboardState

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

type Position

type Position struct {
	X int
	Y int
}

func (Position) Less

func (self Position) Less(other Position) bool

type Prompt

type Prompt struct {
	Text   string
	Length int
}

type Readline

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

func New

func New(loop *loop.Loop, r RlInit) *Readline

func (*Readline) AddHistoryItem

func (self *Readline) AddHistoryItem(hi HistoryItem)

func (*Readline) AllText

func (self *Readline) AllText() string

func (*Readline) ChangeLoopAndResetText

func (self *Readline) ChangeLoopAndResetText(lp *loop.Loop)

func (*Readline) CursorAtEndOfLine

func (self *Readline) CursorAtEndOfLine() bool

func (*Readline) End

func (self *Readline) End()

func (*Readline) HistoryCompleter

func (self *Readline) HistoryCompleter(before_cursor, after_cursor string) *cli.Completions

func (*Readline) MoveCursorToEnd

func (self *Readline) MoveCursorToEnd() bool

func (*Readline) OnKeyEvent

func (self *Readline) OnKeyEvent(event *loop.KeyEvent) error

func (*Readline) OnResize

func (self *Readline) OnResize(old_size loop.ScreenSize, new_size loop.ScreenSize) error

func (*Readline) OnText

func (self *Readline) OnText(text string, from_key_event bool, in_bracketed_paste bool) error

func (*Readline) Redraw

func (self *Readline) Redraw()

func (*Readline) RedrawNonAtomic

func (self *Readline) RedrawNonAtomic()

func (*Readline) ResetText

func (self *Readline) ResetText()

func (*Readline) SetPrompt

func (self *Readline) SetPrompt(prompt string)

func (*Readline) SetText

func (self *Readline) SetText(text string)

func (*Readline) Shutdown

func (self *Readline) Shutdown()

func (*Readline) Start

func (self *Readline) Start()

func (*Readline) TextAfterCursor

func (self *Readline) TextAfterCursor() string

func (*Readline) TextBeforeCursor

func (self *Readline) TextBeforeCursor() string

type RlInit

type RlInit struct {
	Prompt                  string
	HistoryPath             string
	HistoryCount            int
	ContinuationPrompt      string
	EmptyContinuationPrompt bool
	DontMarkPrompts         bool
	SyntaxHighlighter       SyntaxHighlightFunction
	Completer               CompleterFunction
}

type ScreenLine

type ScreenLine struct {
	ParentLineNumber, OffsetInParentLine         int
	Prompt                                       Prompt
	TextLengthInCells, CursorCell, CursorTextPos int
	Text                                         string
	AfterLineBreak                               bool
}

type ShortcutMap

type ShortcutMap = shortcuts.ShortcutMap[Action]

type SyntaxHighlightFunction

type SyntaxHighlightFunction = func(text string, x, y int) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳