Documentation
ΒΆ
Overview ΒΆ
escapy.go These are standalone versions of the cursor manipulation functions. They write directly to os.Stdout.
Index ΒΆ
- func ClearScreen()
- func ClearToBOL()
- func ClearToEOL()
- func ClearToEOS()
- func CurToCol(col int)
- func CurToRow(row int)
- func Down()
- func EnterCaMode()
- func ExitCaMode()
- func HideCur()
- func Home()
- func Left()
- func MoveDown(lines int)
- func MoveLeft(lines int)
- func MoveRight(lines int)
- func MoveTo(row, col int)
- func MoveUp(lines int)
- func RestoreCurPos()
- func Right()
- func SaveCurPos()
- func ShowCur()
- func Up()
- type TermSettings
- type Termy
- func (t *Termy) ClearScreen()
- func (t *Termy) ClearToBOL()
- func (t *Termy) ClearToEOL()
- func (t *Termy) ClearToEOS()
- func (t *Termy) Code() string
- func (t *Termy) CurToCol(col int)
- func (t *Termy) CurToRow(row int)
- func (t *Termy) Down()
- func (t *Termy) EnterCaMode()
- func (t *Termy) Escaped() string
- func (t *Termy) ExitCaMode()
- func (t *Termy) HideCur()
- func (t *Termy) Home()
- func (t *Termy) Left()
- func (t *Termy) MoveDown(lines int)
- func (t *Termy) MoveLeft(cols int)
- func (t *Termy) MoveRight(cols int)
- func (t *Termy) MoveTo(x, y int)
- func (t *Termy) MoveUp(lines int)
- func (t *Termy) RestoreCurPos()
- func (t *Termy) Right()
- func (t *Termy) SaveCurPos()
- func (t *Termy) Send()
- func (t *Termy) ShowCur()
- func (t *Termy) Up()
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func ClearScreen ΒΆ
func ClearScreen()
func ClearToBOL ΒΆ
func ClearToBOL()
func ClearToEOL ΒΆ
func ClearToEOL()
func ClearToEOS ΒΆ
func ClearToEOS()
func EnterCaMode ΒΆ
func EnterCaMode()
func ExitCaMode ΒΆ
func ExitCaMode()
func RestoreCurPos ΒΆ
func RestoreCurPos()
func SaveCurPos ΒΆ
func SaveCurPos()
Types ΒΆ
type TermSettings ΒΆ
type TermSettings struct {
// contains filtered or unexported fields
}
func New ΒΆ
func New(fd int, echo bool) *TermSettings
New creates an instance of TermSettings to handle the terminal state. fd: file descriptor (as in os.Stdout.Fd()), echo: Set to false to disable automatic echoing of user input.
func (*TermSettings) Cbreaky ΒΆ
func (ts *TermSettings) Cbreaky() error
Cbreaky set the terminal (actually, STDIN) in a cbreak-like mode. Accepts an optional bool to disable echo as well. On success it saves the original state so you can retore it later. Example usage:
term := termy.New(int(os.Stdin.Fd()), false) err := term.Cbreaky() if err != nil ... defer term.Restore()
func (*TermSettings) Restore ΒΆ
func (ts *TermSettings) Restore() error
Restore sets the terminal to its previous state. It returns an error if the previous state was not saved. Tipically you will call Restore after Cbreaky (probably with `defer`)
func (*TermSettings) Size ΒΆ
func (ts *TermSettings) Size() (rows, cols int, err error)
TODO: Should size be part of "Termy"? TODO: How should we handle "resize"?
type Termy ΒΆ
Termy struct handles in-band colour and style commands for its tty. tty would normally be os.Stdout.
func NewTermy ΒΆ
NewTermy sets up a new Termy struct to handle in-band signalling to the selected io.Writer.
func (*Termy) ClearScreen ΒΆ
func (t *Termy) ClearScreen()
Clear the screen and move the cursor to the upper left corner.
func (*Termy) Code ΒΆ
Code generates the code for the currently selected colours and/or style. It doesn't prepend the CSI.
func (*Termy) Escaped ΒΆ
Escaped converts the colour and style sequence in an in-band command. prepending the CSI and appending a terminator string.
func (*Termy) Home ΒΆ
func (t *Termy) Home()
Cursor manipulation:
Home moves the cursor to the top left corner of the terminal.
func (*Termy) RestoreCurPos ΒΆ
func (t *Termy) RestoreCurPos()
Restore the cursor position to a previously saved one.
Directories
ΒΆ
Path | Synopsis |
---|---|
Package colours generate the colour codes to be embedded in a colour escape sequence.
|
Package colours generate the colour codes to be embedded in a colour escape sequence. |
Package styles serves to generate the sequence to signal in-band styles to the terminal.
|
Package styles serves to generate the sequence to signal in-band styles to the terminal. |