Version: v0.16.0 Latest Latest

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

Go to latest
Published: Apr 3, 2021 License: Apache-2.0 Imports: 10 Imported by: 32



Package termbox implements terminal using the nsf/termbox-go library. Prefer to use tcell instead, nsf/termbox-go is no longer maintained.



View Source
const DefaultColorMode = terminalapi.ColorMode256

DefaultColorMode is the default value for the ColorMode option.


This section is empty.


This section is empty.


type Option

type Option interface {
	// contains filtered or unexported methods

Option is used to provide options.

func ColorMode

func ColorMode(cm terminalapi.ColorMode) Option

ColorMode sets the terminal color mode. Defaults to DefaultColorMode.

type Terminal

type Terminal struct {
	// contains filtered or unexported fields

Terminal provides input and output to a real terminal. Wraps the nsf/termbox-go terminal implementation. This object is not thread-safe.

Prefer to use tcell instead, nsf/termbox-go is no longer maintained.

Implements terminalapi.Terminal.

func New

func New(opts ...Option) (*Terminal, error)

New returns a new termbox based Terminal. Call Close() when the terminal isn't required anymore.

func (*Terminal) Clear

func (t *Terminal) Clear(opts ...cell.Option) error

Clear implements terminalapi.Terminal.Clear.

func (*Terminal) Close

func (t *Terminal) Close()

Close closes the terminal, should be called when the terminal isn't required anymore to return the screen to a sane state. Implements terminalapi.Terminal.Close.

func (*Terminal) Event

func (t *Terminal) Event(ctx context.Context) terminalapi.Event

Event implements terminalapi.Terminal.Event.

func (*Terminal) Flush

func (t *Terminal) Flush() error

Flush implements terminalapi.Terminal.Flush.

func (*Terminal) HideCursor

func (t *Terminal) HideCursor()

HideCursor implements terminalapi.Terminal.HideCursor.

func (*Terminal) SetCell

func (t *Terminal) SetCell(p image.Point, r rune, opts ...cell.Option) error

SetCell implements terminalapi.Terminal.SetCell.

func (*Terminal) SetCursor

func (t *Terminal) SetCursor(p image.Point)

SetCursor implements terminalapi.Terminal.SetCursor.

func (*Terminal) Size

func (t *Terminal) Size() image.Point

Size implements terminalapi.Terminal.Size.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL