Documentation ¶
Index ¶
- Constants
- Variables
- func EraseLine(out FileWriter, mode EraseLineMode)
- func NewAnsiStderr(out FileWriter) io.Writer
- func NewAnsiStdout(out FileWriter) io.Writer
- type BufferedReader
- type Coord
- type Cursor
- func (c *Cursor) Back(n int)
- func (c *Cursor) Down(n int)
- func (c *Cursor) Forward(n int)
- func (c *Cursor) Hide()
- func (c *Cursor) HorizontalAbsolute(x int)
- func (c *Cursor) Location(buf *bytes.Buffer) (*Coord, error)
- func (c *Cursor) Move(x int, y int)
- func (c *Cursor) MoveNextLine(cur *Coord, terminalSize *Coord)
- func (c *Cursor) NextLine(n int)
- func (c *Cursor) PreviousLine(n int)
- func (c *Cursor) Restore()
- func (c *Cursor) Save()
- func (c *Cursor) Show()
- func (c *Cursor) Size(buf *bytes.Buffer) (*Coord, error)
- func (c *Cursor) Up(n int)
- type EraseLineMode
- type FileReader
- type FileWriter
- type RuneReader
- type Short
- type Stdio
Constants ¶
const ( KeyArrowLeft = '\x02' KeyArrowRight = '\x06' KeyArrowUp = '\x10' KeyArrowDown = '\x0e' KeySpace = ' ' KeyEnter = '\r' KeyBackspace = '\b' KeyDelete = '\x7f' KeyInterrupt = '\x03' KeyEndTransmission = '\x04' KeyEscape = '\x1b' KeyDeleteWord = '\x17' // Ctrl+W KeyDeleteLine = '\x18' // Ctrl+X SpecialKeyHome = '\x01' SpecialKeyEnd = '\x11' SpecialKeyDelete = '\x12' IgnoreKey = '\000' )
Variables ¶
var (
InterruptErr = errors.New("interrupt")
)
Functions ¶
func EraseLine ¶ added in v1.0.1
func EraseLine(out FileWriter, mode EraseLineMode)
func NewAnsiStderr ¶
func NewAnsiStderr(out FileWriter) io.Writer
Returns special stderr, which converts escape sequences to Windows API calls on Windows environment.
func NewAnsiStdout ¶
func NewAnsiStdout(out FileWriter) io.Writer
Returns special stdout, which converts escape sequences to Windows API calls on Windows environment.
Types ¶
type BufferedReader ¶ added in v1.6.0
type Coord ¶ added in v1.2.0
func (Coord) CursorIsAtLineBegin ¶ added in v1.5.2
func (Coord) CursorIsAtLineEnd ¶ added in v1.5.2
type Cursor ¶ added in v1.6.0
type Cursor struct { In FileReader Out FileWriter }
func (*Cursor) HorizontalAbsolute ¶ added in v1.6.0
HorizontalAbsolute moves cursor horizontally to x.
func (*Cursor) Location ¶ added in v1.6.0
Location returns the current location of the cursor in the terminal
func (*Cursor) MoveNextLine ¶ added in v1.6.0
for comparability purposes between windows in unix we need to print out a new line on some terminals
func (*Cursor) NextLine ¶ added in v1.6.0
NextLine moves cursor to beginning of the line n lines down.
func (*Cursor) PreviousLine ¶ added in v1.6.0
PreviousLine moves cursor to beginning of the line n lines up.
func (*Cursor) Restore ¶ added in v1.6.0
func (c *Cursor) Restore()
Restore restores the saved position of the cursor
type EraseLineMode ¶ added in v1.0.1
type EraseLineMode int
const ( ERASE_LINE_END EraseLineMode = iota ERASE_LINE_START ERASE_LINE_ALL )
type FileReader ¶ added in v1.6.0
FileReader provides a minimal interface for Stdout.
type FileWriter ¶ added in v1.6.0
FileWriter provides a minimal interface for Stdin.
type RuneReader ¶ added in v1.1.1
type RuneReader struct {
// contains filtered or unexported fields
}
func NewRuneReader ¶ added in v1.1.1
func NewRuneReader(stdio Stdio) *RuneReader
func (*RuneReader) Buffer ¶ added in v1.6.0
func (rr *RuneReader) Buffer() *bytes.Buffer
func (*RuneReader) ReadLine ¶ added in v1.1.1
func (rr *RuneReader) ReadLine(mask rune) ([]rune, error)
func (*RuneReader) RestoreTermMode ¶ added in v1.1.1
func (rr *RuneReader) RestoreTermMode() error
func (*RuneReader) SetTermMode ¶ added in v1.1.1
func (rr *RuneReader) SetTermMode() error
For reading runes we just want to disable echo.
type Stdio ¶ added in v1.6.0
type Stdio struct { In FileReader Out FileWriter Err io.Writer }
Stdio is the standard input/output the terminal reads/writes with.