state

package
v0.0.0-...-80c3d28 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: BSD-3-Clause Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MouseNone int = iota
	MouseClick
	MouseDrag
	MouseMove
)
View Source
const (
	MouseX10 int = iota
	MouseUTF8
	MouseSGR
	MouseRXVT
)

Variables

View Source
var NamedColors = map[int]string{
	0:  "black",
	1:  "red",
	2:  "green",
	3:  "yellow",
	4:  "blue",
	5:  "magenta",
	6:  "cyan",
	7:  "white",
	8:  "bright black",
	9:  "bright red",
	10: "bright green",
	11: "bright yellow",
	12: "bright blue",
	13: "bright magenta",
	14: "bright cyan",
	15: "bright white",
}

Functions

This section is empty.

Types

type CellRune

type CellRune struct {
	Rune  rune
	Width int
}

type Color

type Color interface{}

type DefaultColor

type DefaultColor struct{}

type IndexColor

type IndexColor struct {
	Index int
}

func (IndexColor) String

func (i IndexColor) String() string

type LineInfo

type LineInfo struct {
	Continuation bool
}

type ModifyTx

type ModifyTx interface {
	SetCell(pos Pos, val CellRune) error
	AppendCell(pos Pos, val rune) error
	Close() error
}

type Output

type Output interface {
	MoveCursor(pos Pos) error
	SetCell(pos Pos, val CellRune) error
	BeginTx() ModifyTx
	AppendCell(pos Pos, r rune) error
	ClearRect(r Rect) error
	ScrollRect(s ScrollRect) error
	Output(data []byte) error
	SetTermProp(prop TermAttr, val interface{}) error
	SetPenProp(prop PenAttr, val interface{}, ps PenState) error
	StringEvent(kind string, data []byte) error
	Resize(rows, cols int, lines []LineInfo) error
}

type PenAttr

type PenAttr int
const (
	PenAttrIntensity PenAttr = iota
	PenAttrUnderline
	PenAttrStyle
	PenAttrReverse
	PenAttrStrikethrough
	PenAttrBlink
	PenAttrConceal
	PenAttrWrapper
	PenAttrOverlined
	PenAttrFont
	PenAttrFGColor
	PenAttrBGColor
)

func (PenAttr) String

func (i PenAttr) String() string

type PenGraphic

type PenGraphic uint16
const (
	// used as separate bits, so specified directly
	PenNormal PenGraphic = iota

	PenBold  PenGraphic = (1 << iota)
	PenFaint PenGraphic = (1 << iota)

	PenBlink   PenGraphic = (1 << iota)
	PenConceal PenGraphic = (1 << iota)

	PenItalic  PenGraphic = (1 << iota)
	PenFraktur PenGraphic = (1 << iota)

	PenUnderlineSingle PenGraphic = (1 << iota)
	PenUnderlineDouble PenGraphic = (1 << iota)

	PenReverse       PenGraphic = (1 << iota)
	PenStrikeThrough PenGraphic = (1 << iota)

	PenFramed    PenGraphic = (1 << iota)
	PenEncircled PenGraphic = (1 << iota)

	PenOverlined PenGraphic = (1 << iota)

	PenIntensity PenGraphic = PenBold | PenFaint
	PenStyle     PenGraphic = PenItalic | PenFraktur

	PenUnderlineCurly PenGraphic = PenUnderlineSingle | PenUnderlineDouble
	PenUnderline      PenGraphic = PenUnderlineCurly

	PenWrapper PenGraphic = PenFramed | PenEncircled
)

func (PenGraphic) String

func (i PenGraphic) String() string

type PenState

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

func (*PenState) Attrs

func (p *PenState) Attrs() PenGraphic

func (*PenState) BGColor

func (p *PenState) BGColor() Color

func (*PenState) FGColor

func (p *PenState) FGColor() Color

func (*PenState) Font

func (p *PenState) Font() int

type Pos

type Pos struct {
	Row, Col int
}

type RGBColor

type RGBColor struct {
	Red, Green, Blue uint8
}

type Rect

type Rect struct {
	Start, End Pos
}

func (Rect) Height

func (r Rect) Height() int

func (Rect) ScrollDown

func (s Rect) ScrollDown(dist int) ScrollRect

func (Rect) ScrollLeft

func (s Rect) ScrollLeft(dist int) ScrollRect

func (Rect) ScrollRight

func (s Rect) ScrollRight(dist int) ScrollRect

func (Rect) ScrollUp

func (s Rect) ScrollUp(dist int) ScrollRect

func (Rect) SplitColumns

func (s Rect) SplitColumns(perc float32) (Rect, Rect)

Split the rectangle into two rectangles as columns within the original rectangle. The size of the right rectangle is a +perc+ percentage of the original

func (Rect) SplitEvenColumns

func (s Rect) SplitEvenColumns() (Rect, Rect)

Split the rectangle into 2 parts as though we were to run a line down the middle vertically in the original.

func (Rect) SplitEvenRows

func (s Rect) SplitEvenRows() (Rect, Rect)

Split the rectangle into 2 parts as though we were to run a line down the middle horizontally in the original.

func (Rect) SplitRows

func (s Rect) SplitRows(perc float32) (Rect, Rect)

Split the rectangle into two rectangles as rows within the original rectangle. The size of the bottom rectangle is a +perc+ percentage of the original

func (Rect) Width

func (r Rect) Width() int

type ScrollDirection

type ScrollDirection int
const (
	ScrollNone  ScrollDirection = iota // don't scroll
	ScrollUp                           // move the content at the top of the rect to the bottom
	ScrollDown                         // move the content at the bottom of the rect to the top
	ScrollRight                        // move the content on the right side of the rect to the left side
	ScrollLeft                         // move the content on the left side of the rect to the right side
)

func (ScrollDirection) String

func (i ScrollDirection) String() string

type ScrollRect

type ScrollRect struct {
	Rect
	Direction ScrollDirection
	Distance  int
}

type State

type State struct {
	Debug bool
	Id    string
	// contains filtered or unexported fields
}

func NewState

func NewState(rows, cols int, output Output) (*State, error)

func (*State) HandleEvent

func (s *State) HandleEvent(gev parser.Event) error

func (*State) Reset

func (s *State) Reset() error

func (*State) Resize

func (s *State) Resize(rows, cols int) error

type TermAttr

type TermAttr int
const (
	TermAttrTitle TermAttr = iota
	TermAttrIconName
	TermAttrReverse
	TermAttrBlink
	TermAttrVisible
	TermAttrMouse
	TermAttrAltScreen
	TermAttrOSC
)

func (TermAttr) String

func (i TermAttr) String() string

Jump to

Keyboard shortcuts

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