Documentation ¶
Index ¶
- Constants
- func Size() (cols, rows int)
- type Attribute
- type Keyboard
- type MockKeyboard
- type Screen
- func (screen *Screen) Alert(msg string)
- func (screen *Screen) Clear()
- func (screen *Screen) Close()
- func (screen *Screen) Col() int
- func (screen *Screen) Colorize(row int, colors []syntaxcolor.LineColor, offset int)
- func (screen *Screen) DecorateStatusLine()
- func (screen *Screen) Flush()
- func (screen *Screen) Highlight(row, col int)
- func (screen *Screen) ListCharModes() []string
- func (screen *Screen) Notify(msg string)
- func (screen *Screen) Open()
- func (screen *Screen) PrintableRune(c rune) (rune, int)
- func (screen *Screen) ReallyClear()
- func (screen *Screen) Row() int
- func (screen *Screen) SetCharMode(c int)
- func (screen *Screen) SetCursor(r, c int)
- func (screen *Screen) Size() (int, int)
- func (screen *Screen) StringDispLen(s string) int
- func (screen *Screen) Suspend()
- func (screen *Screen) WriteMessage(msg string)
- func (screen *Screen) WriteString(row, col int, s string)
- func (screen *Screen) WriteStringColor(row, col int, s string, fg, bg Attribute)
Constants ¶
const ( ColorBlue = Attribute(termbox.ColorBlue) ColorRed = Attribute(termbox.ColorRed) ColorGreen = Attribute(termbox.ColorGreen) ColorYellow = Attribute(termbox.ColorYellow) ColorCyan = Attribute(termbox.ColorCyan) ColorMagenta = Attribute(termbox.ColorMagenta) ColorWhite = Attribute(termbox.ColorWhite) ColorDefault = Attribute(termbox.ColorDefault) AttrBold = Attribute(termbox.AttrBold) AttrReverse = Attribute(termbox.AttrReverse) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Keyboard ¶
Keyboard acts as an interface to the termbox keyboard.
func NewKeyboard ¶
func NewKeyboard() *Keyboard
NewKeyboard defines a map from termbox key to a string representation.
func (*Keyboard) GetCmdString ¶
GetCmdString turns termbox keyboard input into a string representation of the keypress. If the result is "char", then it also returns the rune.
type MockKeyboard ¶ added in v0.6.2
type MockKeyboard struct {
// contains filtered or unexported fields
}
Mock keyboard for testing.
func NewMockKeyboard ¶ added in v0.6.2
func NewMockKeyboard(keys []string, runes []rune) *MockKeyboard
func (*MockKeyboard) GetKey ¶ added in v0.6.2
func (mkb *MockKeyboard) GetKey() (string, rune)
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
Screen is an interface the the terminal screen.
func (*Screen) Colorize ¶
func (screen *Screen) Colorize(row int, colors []syntaxcolor.LineColor, offset int)
Colorize changes the color of text on the screen.
func (*Screen) DecorateStatusLine ¶
func (screen *Screen) DecorateStatusLine()
DecorateStatusLine colors the status line text.
func (*Screen) Flush ¶
func (screen *Screen) Flush()
Flush *requests* a terminal flush event (async).
func (*Screen) ListCharModes ¶ added in v0.4.1
ListCharModes lists the available character display modes.
func (*Screen) PrintableRune ¶ added in v0.4.1
PrintableRune uses the charMode to convert the rune into a printable rune.
func (*Screen) ReallyClear ¶
func (screen *Screen) ReallyClear()
ReallyClear writes a repeaded character to the screen and then clears it, to make sure all terminal garbage is gone.
func (*Screen) SetCharMode ¶ added in v0.4.1
SetCharMode sets the character display mode.
func (*Screen) StringDispLen ¶ added in v0.4.1
StringDispLen estimates the display length of a string.
func (*Screen) Suspend ¶ added in v0.3.3
func (screen *Screen) Suspend()
Suspend suspends the screen interaction to let the user access the terminal.
func (*Screen) WriteMessage ¶
WriteMessage writes a status-line message.
func (*Screen) WriteString ¶
WriteString write a string to the screen in the default color scheme.