Documentation ¶
Overview ¶
Package terminalapi defines the API of all terminal implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorMode ¶
type ColorMode int
ColorMode represents a color mode of a terminal.
const ( // ColorModeNormal supports 8 "system" colors. // These are defined as constants in the cell package. ColorModeNormal ColorMode = iota // ColorMode256 enables using any of the 256 terminal colors. // 0-7: the 8 "system" colors accessible in ColorModeNormal. // 8-15: the 8 "bright system" colors. // 16-231: the 216 different terminal colors. // 232-255: the 24 different shades of grey. ColorMode256 // ColorMode216 supports only the third range of the ColorMode256, i.e the // 216 different terminal colors. However in this mode the colors are zero // based, so the caller doesn't need to provide an offset. ColorMode216 // ColorModeGrayscale supports only the fourth range of the ColorMode256, // i.e the 24 different shades of grey. However in this mode the colors are // zero based, so the caller doesn't need to provide an offset. ColorModeGrayscale )
Supported color modes.
type Error ¶
type Error string
Error is an event indicating an error while processing input.
type Event ¶
type Event interface {
// contains filtered or unexported methods
}
Event represents an input event.
type Mouse ¶
type Mouse struct { // Position of the mouse on the terminal. Position image.Point // Button identifies the pressed button if any. Button mouse.Button }
Mouse is the event used when the mouse is moved or a mouse button is pressed. Implements terminalapi.Event.
type Terminal ¶
type Terminal interface { // Size returns the terminal width and height in cells. Size() image.Point // Clear clears the content of the internal back buffer, resetting all // cells to their default content and attributes. Sets the provided options // on all the cell. Clear(opts ...cell.Option) error // Flush flushes the internal back buffer to the terminal. Flush() error // SetCursor sets the position of the cursor. SetCursor(p image.Point) // HideCursos hides the cursor. HideCursor() // SetCell sets the value of the specified cell to the provided rune. // Use the options to specify which attributes to modify, if an attribute // option isn't specified, the attribute retains its previous value. SetCell(p image.Point, r rune, opts ...cell.Option) error // Event waits for the next event and returns it. // This call blocks until the next event or cancellation of the context. // Returns nil when the context gets canceled. Event(ctx context.Context) Event // Close closes the underlying terminal implementation and should be called when // the terminal isn't required anymore to return the screen to a sane state. Close() }
Terminal abstracts an implementation of a 2-D terminal. A terminal consists of a number of cells.
Click to show internal directories.
Click to hide internal directories.