Documentation
¶
Index ¶
- Constants
- Variables
- func GetLength() int
- func GetSize(fd int) (width, height int, err error)
- func GetWidth() (termWidth int)
- func IsTerminal(fd int) bool
- func MoveCursorBackwards(i int)
- func MoveCursorDown(i int)
- func MoveCursorForwards(i int)
- func MoveCursorUp(i int)
- func Restore(fd int, state *State) error
- type State
Constants ¶
View Source
const ( NewlineReturn = "\r\n" ClearLineAfter = "\x1b[0K" ClearLineBefore = "\x1b[1K" ClearLine = "\x1b[2K" ClearScreenBelow = "\x1b[0J" ClearScreen = "\x1b[2J" // Clears screen, preserving scroll buffer ClearDisplay = "\x1b[3J" // Clears screen fully, wipes the scroll buffer CursorTopLeft = "\x1b[H" SaveCursorPos = "\x1b7" RestoreCursorPos = "\x1b8" HideCursor = "\x1b[?25l" ShowCursor = "\x1b[?25h" )
Terminal control sequences.
Variables ¶
View Source
var ( ArrowUp = string([]byte{27, 91, 65}) // ^[[A ArrowDown = string([]byte{27, 91, 66}) // ^[[B ArrowRight = string([]byte{27, 91, 67}) // ^[[C ArrowLeft = string([]byte{27, 91, 68}) // ^[[D )
Some core keys needed by some stuff.
Functions ¶
func GetLength ¶
func GetLength() int
GetLength returns the length of the terminal (Y length), or 80 if it cannot be established.
func GetWidth ¶
func GetWidth() (termWidth int)
GetWidth returns the width of Stdout or 80 if the width cannot be established.
func IsTerminal ¶
IsTerminal returns true if the given file descriptor is a terminal.
func MoveCursorBackwards ¶
func MoveCursorBackwards(i int)
MoveCursorBackwards moves the cursor backward i columns.
func MoveCursorForwards ¶
func MoveCursorForwards(i int)
MoveCursorForwards moves the cursor forward i columns.
Types ¶
Click to show internal directories.
Click to hide internal directories.