quasibox

package
v0.0.0-...-e60d871 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

This version does additional encapsulation of QuasiScreens rather than real TTY backed terminals.

Index

Constants

View Source
const (
	KeyF1         = Key(tcell.KeyF1)
	KeyF2         = Key(tcell.KeyF2)
	KeyF3         = Key(tcell.KeyF3)
	KeyF4         = Key(tcell.KeyF4)
	KeyF5         = Key(tcell.KeyF5)
	KeyF6         = Key(tcell.KeyF6)
	KeyF7         = Key(tcell.KeyF7)
	KeyF8         = Key(tcell.KeyF8)
	KeyF9         = Key(tcell.KeyF9)
	KeyF10        = Key(tcell.KeyF10)
	KeyF11        = Key(tcell.KeyF11)
	KeyF12        = Key(tcell.KeyF12)
	KeyInsert     = Key(tcell.KeyInsert)
	KeyDelete     = Key(tcell.KeyDelete)
	KeyHome       = Key(tcell.KeyHome)
	KeyEnd        = Key(tcell.KeyEnd)
	KeyArrowUp    = Key(tcell.KeyUp)
	KeyArrowDown  = Key(tcell.KeyDown)
	KeyArrowRight = Key(tcell.KeyRight)
	KeyArrowLeft  = Key(tcell.KeyLeft)
	KeyCtrlA      = Key(tcell.KeyCtrlA)
	KeyCtrlB      = Key(tcell.KeyCtrlB)
	KeyCtrlC      = Key(tcell.KeyCtrlC)
	KeyCtrlD      = Key(tcell.KeyCtrlD)
	KeyCtrlE      = Key(tcell.KeyCtrlE)
	KeyCtrlF      = Key(tcell.KeyCtrlF)
	KeyCtrlG      = Key(tcell.KeyCtrlG)
	KeyCtrlH      = Key(tcell.KeyCtrlH)
	KeyCtrlI      = Key(tcell.KeyCtrlI)
	KeyCtrlJ      = Key(tcell.KeyCtrlJ)
	KeyCtrlK      = Key(tcell.KeyCtrlK)
	KeyCtrlL      = Key(tcell.KeyCtrlL)
	KeyCtrlM      = Key(tcell.KeyCtrlM)
	KeyCtrlN      = Key(tcell.KeyCtrlN)
	KeyCtrlO      = Key(tcell.KeyCtrlO)
	KeyCtrlP      = Key(tcell.KeyCtrlP)
	KeyCtrlQ      = Key(tcell.KeyCtrlQ)
	KeyCtrlR      = Key(tcell.KeyCtrlR)
	KeyCtrlS      = Key(tcell.KeyCtrlS)
	KeyCtrlT      = Key(tcell.KeyCtrlT)
	KeyCtrlU      = Key(tcell.KeyCtrlU)
	KeyCtrlV      = Key(tcell.KeyCtrlV)
	KeyCtrlW      = Key(tcell.KeyCtrlW)
	KeyCtrlX      = Key(tcell.KeyCtrlX)
	KeyCtrlY      = Key(tcell.KeyCtrlY)
	KeyCtrlZ      = Key(tcell.KeyCtrlZ)
	KeyBackspace  = Key(tcell.KeyBackspace)
	KeyBackspace2 = Key(tcell.KeyBackspace2)
	KeyTab        = Key(tcell.KeyTab)
	KeyEnter      = Key(tcell.KeyEnter)
	KeyEsc        = Key(tcell.KeyEscape)
	KeyPgdn       = Key(tcell.KeyPgDn)
	KeyPgup       = Key(tcell.KeyPgUp)
	MouseLeft     = Key(tcell.Button1) // arbitrary assignments
	MouseRight    = Key(tcell.Button3)
	MouseMiddle   = Key(tcell.Button2)
	KeySpace      = Key(tcell.Key(' '))

	// missing set of termbox keybindings used by gocui
	KeyCtrlSpace      = Key(tcell.KeyCtrlSpace)
	MouseRelease      = Key(tcell.ButtonNone)
	MouseWheelUp      = Key(tcell.WheelUp)
	MouseWheelDown    = Key(tcell.WheelDown)
	KeyCtrlBackslash  = Key(tcell.KeyCtrlBackslash)
	KeyCtrlLsqBracket = Key(tcell.KeyCtrlLeftSq)
	KeyCtrlRsqBracket = Key(tcell.KeyCtrlRightSq)
	KeyCtrlUnderscore = Key(tcell.KeyCtrlUnderscore)
)

Keys codes.

View Source
const (
	ModAlt = Modifier(tcell.ModAlt)
)

Modifiers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute uint16

Attribute affects the presentation of characters, such as color, boldness, and so forth.

const (
	ColorDefault Attribute = iota
	ColorBlack
	ColorRed
	ColorGreen
	ColorYellow
	ColorBlue
	ColorMagenta
	ColorCyan
	ColorWhite
)

Colors first. The order here is significant.

const (
	AttrBold Attribute = 1 << (9 + iota)
	AttrUnderline
	AttrReverse
)

Other attributes.

type Cell

type Cell struct {
	Ch rune
	Fg Attribute
	Bg Attribute
}

Cell represents a single character cell on screen.

type Event

type Event struct {
	Type   EventType
	Mod    Modifier
	Key    Key
	Ch     rune
	Width  int
	Height int
	Err    error
	MouseX int
	MouseY int
	N      int
}

Event represents an event like a key press, mouse action, or window resize.

func ParseEvent

func ParseEvent(data []byte) Event

ParseEvent is not supported.

func PollRawEvent

func PollRawEvent(data []byte) Event

PollRawEvent is not supported.

type EventType

type EventType uint8

EventType represents the type of event.

const (
	EventNone EventType = iota
	EventKey
	EventResize
	EventMouse
	EventInterrupt
	EventError
	EventRaw
)

Event types.

type InputMode

type InputMode int

InputMode is mostly unused.

const (
	InputCurrent InputMode = 1 << iota
	InputEsc
	InputAlt
	InputMouse
)

Input modes; mostly here for compatibility.

type Key

type Key tcell.Key

Key is a key press.

type Modifier

type Modifier tcell.ModMask

Modifier represents the possible modifier keys.

type OutputMode

type OutputMode int

OutputMode represents an output mode, which determines how colors are used. See the termbox documentation for an explanation.

const (
	OutputCurrent OutputMode = iota
	OutputNormal
	Output256
	Output216
	OutputGrayscale
)

OutputMode values.

type Quasibox

type Quasibox struct {
	// contains filtered or unexported fields
}

func Init

func Init(in io.ReadCloser, out io.WriteCloser, terminfo string, w, h int) (*Quasibox, error)

Init initializes the screen for use, with the specified backing in/out, terminal type, and size.

func InitLocal

func InitLocal() (*Quasibox, error)

InitLocal initializes a local TTY screen for use.

func (*Quasibox) Clear

func (qb *Quasibox) Clear(fg, bg Attribute)

Clear clears the screen with the given attributes.

func (*Quasibox) Close

func (qb *Quasibox) Close()

Close cleans up the terminal, restoring terminal modes, etc.

func (*Quasibox) Flush

func (qb *Quasibox) Flush() error

Flush updates the screen.

func (*Quasibox) GetCellRune

func (qb *Quasibox) GetCellRune(x, y int) rune

GetCellRune added to complete compatability implementation for gocui

func (*Quasibox) HideCursor

func (qb *Quasibox) HideCursor()

HideCursor hides the terminal cursor.

func (*Quasibox) Interrupt

func (qb *Quasibox) Interrupt()

Interrupt posts an interrupt event.

func (*Quasibox) PollEvent

func (qb *Quasibox) PollEvent() Event

PollEvent blocks until an event is ready, and then returns it.

func (*Quasibox) SetCell

func (qb *Quasibox) SetCell(x, y int, ch rune, fg, bg Attribute)

SetCell sets the character cell at a given location to the given content (rune) and attributes.

func (*Quasibox) SetCursor

func (qb *Quasibox) SetCursor(x, y int)

SetCursor displays the terminal cursor at the given location.

func (*Quasibox) SetInputMode

func (qb *Quasibox) SetInputMode(mode InputMode) InputMode

SetInputMode will only enable mouse mode. Otherwise unused.

func (*Quasibox) SetOutputMode

func (qb *Quasibox) SetOutputMode(mode OutputMode) OutputMode

SetOutputMode is used to set the color palette used.

func (*Quasibox) SetSize

func (qb *Quasibox) SetSize(w, h int)

SetSize controls resizing of a quasiscreen. This will be a no-op on tscreens.

func (*Quasibox) Size

func (qb *Quasibox) Size() (int, int)

Size returns the screen size as width, height in character cells.

func (*Quasibox) Sync

func (qb *Quasibox) Sync() error

Sync forces a resync of the screen.

Jump to

Keyboard shortcuts

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