Documentation
¶
Index ¶
- Constants
- Variables
- func CursorDownN(n int) string
- func CursorLeftN(n int) string
- func CursorRightN(n int) string
- func CursorUpN(n int) string
- func IsTerminal(fd uintptr) bool
- func UnsetRawMode(fd uintptr, termios any) error
- type Buffer
- func (b *Buffer) Add(r rune)
- func (b *Buffer) AddChar(r rune, insert bool)
- func (b *Buffer) ClearScreen()
- func (b *Buffer) Delete()
- func (b *Buffer) DeleteBefore()
- func (b *Buffer) DeleteRemaining()
- func (b *Buffer) DeleteWord()
- func (b *Buffer) DisplaySize() int
- func (b *Buffer) GetLineSpacing(line int) bool
- func (b *Buffer) IsEmpty() bool
- func (b *Buffer) MoveLeft()
- func (b *Buffer) MoveLeftWord()
- func (b *Buffer) MoveRight()
- func (b *Buffer) MoveRightWord()
- func (b *Buffer) MoveToEnd()
- func (b *Buffer) MoveToStart()
- func (b *Buffer) Remove()
- func (b *Buffer) Replace(r []rune)
- func (b *Buffer) String() string
- func (b *Buffer) StringN(n int) string
- func (b *Buffer) StringNM(n, m int) string
- type History
- type Instance
- type InterruptError
- type Prompt
- type Terminal
- type Termios
Constants ¶
View Source
const ( CharNull = 0 CharLineStart = 1 CharBackward = 2 CharInterrupt = 3 CharDelete = 4 CharLineEnd = 5 CharForward = 6 CharBell = 7 CharCtrlH = 8 CharTab = 9 CharCtrlJ = 10 CharKill = 11 CharCtrlL = 12 CharEnter = 13 CharNext = 14 CharPrev = 16 CharBckSearch = 18 CharFwdSearch = 19 CharTranspose = 20 CharCtrlU = 21 CharCtrlW = 23 CharCtrlY = 25 CharCtrlZ = 26 CharEsc = 27 CharSpace = 32 CharEscapeEx = 91 CharBackspace = 127 )
View Source
const ( KeyDel = 51 KeyUp = 65 KeyDown = 66 KeyRight = 67 KeyLeft = 68 MetaEnd = 70 MetaStart = 72 )
View Source
const ( Esc = "\x1b" CursorSave = Esc + "[s" CursorRestore = Esc + "[u" CursorEOL = Esc + "[E" CursorBOL = Esc + "[1G" CursorHide = Esc + "[?25l" CursorShow = Esc + "[?25h" ClearToEOL = Esc + "[K" ClearLine = Esc + "[2K" ClearScreen = Esc + "[2J" CursorReset = Esc + "[0;0f" ColorGrey = Esc + "[38;5;245m" ColorDefault = Esc + "[0m" StartBracketedPaste = Esc + "[?2004h" EndBracketedPaste = Esc + "[?2004l" )
View Source
const ( CharBracketedPaste = 50 CharBracketedPasteStart = "00~" CharBracketedPasteEnd = "01~" )
Variables ¶
View Source
var ( CursorUp = CursorUpN(1) CursorDown = CursorDownN(1) CursorRight = CursorRightN(1) CursorLeft = CursorLeftN(1) )
View Source
var ErrInterrupt = errors.New("Interrupt")
Functions ¶
func CursorDownN ¶
func CursorLeftN ¶
func CursorRightN ¶
func IsTerminal ¶
IsTerminal returns true if the given file descriptor is a terminal.
func UnsetRawMode ¶
Types ¶
type Buffer ¶
type Buffer struct { DisplayPos int Pos int Buf *arraylist.List[rune] // LineHasSpace is an arraylist of bools to keep track of whether a line has a space at the end LineHasSpace *arraylist.List[bool] Prompt *Prompt LineWidth int Width int Height int }
func (*Buffer) ClearScreen ¶
func (b *Buffer) ClearScreen()
func (*Buffer) DeleteBefore ¶
func (b *Buffer) DeleteBefore()
func (*Buffer) DeleteRemaining ¶
func (b *Buffer) DeleteRemaining()
func (*Buffer) DeleteWord ¶
func (b *Buffer) DeleteWord()
func (*Buffer) DisplaySize ¶
func (*Buffer) GetLineSpacing ¶
func (*Buffer) MoveLeftWord ¶
func (b *Buffer) MoveLeftWord()
func (*Buffer) MoveRightWord ¶
func (b *Buffer) MoveRightWord()
func (*Buffer) MoveToStart ¶
func (b *Buffer) MoveToStart()
type History ¶
type History struct { Buf *arraylist.List[string] Autosave bool Pos int Limit int Filename string Enabled bool }
func NewHistory ¶
type Instance ¶
func (*Instance) HistoryDisable ¶
func (i *Instance) HistoryDisable()
func (*Instance) HistoryEnable ¶
func (i *Instance) HistoryEnable()
type InterruptError ¶
type InterruptError struct {
Line []rune
}
func (*InterruptError) Error ¶
func (*InterruptError) Error() string
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
func NewTerminal ¶
Click to show internal directories.
Click to hide internal directories.