ecma48

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Up = iota
	Down
	Right
	Left
)

Directions!

Variables

This section is empty.

Functions

This section is empty.

Types

type AltChar

type AltChar struct {
	Char rune
}

AltChar is for alt+[character]

type AltShiftChar

type AltShiftChar struct {
	Char rune
}

AltShiftChar is for alt+shift+[character]

type Backspace

type Backspace struct{}

Backspace ('\b')

type CHA

type CHA struct {
	X int
}

CHA (Cursor Horizontal Absolute)

type CNL

type CNL struct {
	YDiff uint
}

CNL (Cursor Next Line)

type CPL

type CPL struct {
	YDiff uint
}

CPL (Cursor Previous Line)

type CUP

type CUP struct {
	X int
	Y int
}

CUP (Cursor Position)

type CarriageReturn

type CarriageReturn struct{}

CarriageReturn ('\r')

type Char

type Char struct {
	Rune   rune
	IsWide bool
}

Char is a single character that may occupy multiple cells

type Color

type Color struct {
	ColorMode
	Code int32
}

Color stores sufficient data to reproduce an ANSI-encodable color

type ColorMode

type ColorMode int

ColorMode is the type of color associated with a cursor

const (
	// ColorNone is the default unset color state
	ColorNone ColorMode = iota
	// ColorBit3Normal is for the 8 default non-bright colors
	ColorBit3Normal
	// ColorBit3Bright is for the 8 default bright colors
	ColorBit3Bright
	// ColorBit8 is specified at https://en.wikipedia.org/w/index.php?title=ANSI_escape_code&oldid=873901864#8-bit
	ColorBit8
	// ColorBit24 is specified at https://en.wikipedia.org/w/index.php?title=ANSI_escape_code&oldid=873901864#24-bit
	ColorBit24
)

type CtrlChar

type CtrlChar struct {
	Char rune
}

CtrlChar is for ctrl+[character]

type Cursor

type Cursor struct {
	X, Y int
	Style
}

Cursor is Style along with position. Coordinates are relative to top left

type CursorMovement

type CursorMovement struct {
	Direction
	N int

	Alt   bool
	Shift bool
	Ctrl  bool
}

CursorMovement is possibly caused by an arrow key

type DCH

type DCH struct {
	N int
}

DCH (Delete Characters)

type DECSTBM

type DECSTBM struct {
	Top    int
	Bottom int
}

DECSTBM (Set Scrolling Region). Bottom is -1 if it should be the bottom of the screen

type DL

type DL struct {
	N int
}

DL (Delete Lines)

type Delete

type Delete struct{}

Delete (0x7F)

type Direction

type Direction int

Direction is Up, Down, Left, or Right

type ED

type ED struct {
	Directive int
}

ED (Erase in Display)

type EL

type EL struct {
	Directive int
}

EL (Erase in Line)

type EOF

type EOF struct{}

type Esc

type Esc struct{}

type ICH

type ICH struct {
	N int
}

ICH (Insert Characters)

type IL

type IL struct {
	N int
}

IL (Insert Lines)

type MouseDown

type MouseDown struct {
	X, Y int
}

type MouseDrag

type MouseDrag struct {
	X, Y int
}

type MouseUp

type MouseUp struct {
	X, Y int
}

type Newline

type Newline struct{}

Newline ('\n')

type Output

type Output struct {
	Raw []rune
	Parsed
}

Output is the output of the parser

type Parsed

type Parsed interface {
}

Parsed could be a simple character or maybe an escape sequence

type Parser

type Parser struct {

	// RuneCounter is useful for detecting if the processer is lagging
	RuneCounter uint64

	Shutdown chan error
	// contains filtered or unexported fields
}

Parser maintains state. Create one with NewParser() then start the parsing via Run()

func NewParser

func NewParser(keyboardMode bool) *Parser

NewParser creates a parser to be used for Parse()

func (*Parser) Parse

func (p *Parser) Parse(input *bufio.Reader, output chan<- Output) error

Parse starts the parsing process, reading from input, parsing, then sending to output

type PositionedChar

type PositionedChar struct {
	Rune     rune
	IsWide   bool
	PrevWide bool
	Cursor
}

A PositionedChar is a Char with a specific location on the screen

type PrivateDEC

type PrivateDEC struct {
	On   bool
	Code int
}

PrivateDEC is DECSET/DECRST (DEC Private Mode Set/Reset)

type RI

type RI struct{}

RI (Reverse Index)

type Renderer

type Renderer interface {
	HandleCh(PositionedChar)
	SetCursor(x, y int)
}

type SCORC

type SCORC struct{}

SCORC (Restore Cursor Position)

type SCOSC

type SCOSC struct{}

SCOSC (Save Cursor Position)

type SD

type SD struct {
	N uint
}

SD (Scroll Down)

type SU

type SU struct {
	N uint
}

SU (Scroll Up)

type ScrollDown

type ScrollDown int

type ScrollUp

type ScrollUp int

type Style

type Style struct {
	Bold, Faint, Italic, Underline, Conceal, CrossedOut, Reverse bool

	Fg Color // foreground color
	Bg Color // background color
}

Style is the state of the terminal's drawing modes when printing a given character

func (*Style) Reset

func (s *Style) Reset()

Reset sets all rendering attributes of a cursor to their default values

type StyleBackground

type StyleBackground Color

type StyleBold

type StyleBold bool

type StyleConceal

type StyleConceal bool

type StyleCrossedOut

type StyleCrossedOut bool

type StyleFaint

type StyleFaint bool

type StyleForeground

type StyleForeground Color

type StyleItalic

type StyleItalic bool

type StyleReset

type StyleReset struct{}

type StyleReverse

type StyleReverse bool

type StyleUnderline

type StyleUnderline bool

type StyledChar

type StyledChar struct {
	Rune     rune
	IsWide   bool
	PrevWide bool
	Style
}

A Char is a rune with a visual style associated with it

type Tab

type Tab struct{}

Tab ('\t')

type Unrecognized

type Unrecognized string

Unrecognized is when we don't understand the input

type VPA

type VPA struct {
	Y int
}

VPA (Vertical Line Position Absolute)

Jump to

Keyboard shortcuts

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