term

package
v3.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UpArrow denotes up arrow
	UpArrow = []byte{asciiESC, asciiLeftSquareBracket, asciiA}
	// DownArrow denotes down arrow
	DownArrow = []byte{asciiESC, asciiLeftSquareBracket, asciiB}
)

Functions

func EscapeHistoryCommand

func EscapeHistoryCommand(input []byte) []byte

EscapeHistoryCommand escape history command

func EscapeInput

func EscapeInput(input []byte) []byte

EscapeInput escape special characters such as SOH, ENQ and DEL in user input

func EscapeTabCompletion

func EscapeTabCompletion(src []byte) []byte

EscapeTabCompletion escape tab completion

func HasDownArrowSuffix

func HasDownArrowSuffix(input []byte) bool

HasDownArrowSuffix test whether input has down arrow suffix

func HasUpArrowSuffix

func HasUpArrowSuffix(input []byte) bool

HasUpArrowSuffix test whether input has up arrow suffix

func IsBell

func IsBell(bs []byte) bool

IsBell test whether input is Bell

func IsCR

func IsCR(input []byte) bool

IsCR test whether input is CR

func IsTab

func IsTab(input []byte) bool

IsTab test whether input is Tab

Types

type Input

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

Input denotes user input from terminal

func NewInput

func NewInput() *Input

NewInput return an initialized *Input

func (*Input) AddCharacter

func (in *Input) AddCharacter(r rune)

AddCharacter add one character to input

func (*Input) Backspace

func (in *Input) Backspace()

Backspace delete the last character to input

func (*Input) DeleteCharacterUnderCursor

func (in *Input) DeleteCharacterUnderCursor()

DeleteCharacterUnderCursor delete the character under the cursor

func (*Input) DeleteCharactersAfterCursor

func (in *Input) DeleteCharactersAfterCursor()

DeleteCharactersAfterCursor delete the character after the cursor

func (*Input) DeleteCharactersBeforeCursor

func (in *Input) DeleteCharactersBeforeCursor()

DeleteCharactersBeforeCursor delete characters before the cursor

func (*Input) DeleteOneWordBeforeCursor

func (in *Input) DeleteOneWordBeforeCursor()

DeleteOneWordBeforeCursor delete word before the cursor

func (*Input) GoBackOneCharacter

func (in *Input) GoBackOneCharacter()

GoBackOneCharacter go back one character

func (*Input) GoBackOneWord

func (in *Input) GoBackOneWord()

GoBackOneWord go back one word

func (*Input) GoEnd

func (in *Input) GoEnd()

GoEnd go to the end of the input

func (*Input) GoForwardOneCharacter

func (in *Input) GoForwardOneCharacter()

GoForwardOneCharacter go forward one character

func (*Input) GoForwardOneWord

func (in *Input) GoForwardOneWord()

GoForwardOneWord go forward one word

func (*Input) GoHead

func (in *Input) GoHead()

GoHead go to the beginning of the input

Jump to

Keyboard shortcuts

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