terminal

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
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

func Size added in v0.6.2

func Size() (cols, rows int)

Return the screen size.

Types

type Attribute added in v0.6.2

type Attribute termbox.Attribute

type Keyboard

type Keyboard struct {
	KeyMap    map[termbox.Key]string
	AltKeyMap map[string]string
}

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

func (kb *Keyboard) GetCmdString(ev termbox.Event) (string, rune)

GetCmdString turns termbox keyboard input into a string representation of the keypress. If the result is "char", then it also returns the rune.

func (*Keyboard) GetKey

func (kb *Keyboard) GetKey() (string, rune)

GetKey returns the human-readable name for a keypress, or the rune if it is character.

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 NewScreen

func NewScreen() *Screen

NewScreen creates a new screen object.

func (*Screen) Alert added in v0.3.1

func (screen *Screen) Alert(msg string)

Alert is the same as Notify.

func (*Screen) Clear

func (screen *Screen) Clear()

Clear clears the screen.

func (*Screen) Close

func (screen *Screen) Close()

Close ends the terminal session.

func (*Screen) Col added in v0.6.2

func (screen *Screen) Col() int

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) Highlight

func (screen *Screen) Highlight(row, col int)

Highlight reverses the screen color.

func (*Screen) ListCharModes added in v0.4.1

func (screen *Screen) ListCharModes() []string

ListCharModes lists the available character display modes.

func (*Screen) Notify added in v0.3.1

func (screen *Screen) Notify(msg string)

Notify writes a status-line notification.

func (*Screen) Open

func (screen *Screen) Open()

Open starts the terminal session.

func (*Screen) PrintableRune added in v0.4.1

func (screen *Screen) PrintableRune(c rune) (rune, int)

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) Row added in v0.6.2

func (screen *Screen) Row() int

func (*Screen) SetCharMode added in v0.4.1

func (screen *Screen) SetCharMode(c int)

SetCharMode sets the character display mode.

func (*Screen) SetCursor

func (screen *Screen) SetCursor(r, c int)

SetCursor moves the cursor to a position.

func (*Screen) Size added in v0.6.2

func (screen *Screen) Size() (int, int)

Size returns the screen size (col, row).

func (*Screen) StringDispLen added in v0.4.1

func (screen *Screen) StringDispLen(s string) int

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

func (screen *Screen) WriteMessage(msg string)

WriteMessage writes a status-line message.

func (*Screen) WriteString

func (screen *Screen) WriteString(row, col int, s string)

WriteString write a string to the screen in the default color scheme.

func (*Screen) WriteStringColor

func (screen *Screen) WriteStringColor(row, col int, s string, fg, bg Attribute)

WriteStringColor writes a colored string to the screen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL