mterm

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Color16  = 1
	Color256 = 2
	Color16M = 3
)
View Source
const (
	FlagBold uint8 = 1 << iota
	FlagDim
	FlagItalic
	FlagUnderline
	FlagBlink
	FlagInverse
	FlagInvisible
	FlagStrike
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Char rune

	SGRState
	// contains filtered or unexported fields
}

Cell is a single cell in the terminal

type Color

type Color [3]byte

type EscapeError

type EscapeError struct {
	Err    error
	Offset int
}

func (EscapeError) Error

func (e EscapeError) Error() string

type Grid added in v0.0.18

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

func (*Grid) Resize added in v0.0.18

func (g *Grid) Resize(rows, cols int)

Resize regular resize without reflow, it will chomp any extra lines/columns

func (*Grid) ResizeAndReflow added in v0.0.18

func (g *Grid) ResizeAndReflow(rows, cols int)

ResizeAndReflow resize the grid and reflow based on newline markers

func (*Grid) Size added in v0.0.18

func (g *Grid) Size() (rows, cols int)

type SGRState added in v0.0.15

type SGRState struct {
	FG        Color
	BG        Color
	UL        Color // underline color
	ColorType uint8 // 0b00uubbff (u underline, b BG, f FG color types)
	Flags     uint8
}

func (*SGRState) Set added in v0.0.15

func (s *SGRState) Set(p ...int) error

Set the Set based on CSI parameters

type Terminal

type Terminal struct {
	Title   string
	TabSize int
	// contains filtered or unexported fields
}

Terminal is an in memory terminal emulator

func New

func New(rows, cols int) *Terminal

New returns a new terminal with the given rows and cols

func (*Terminal) Cells

func (t *Terminal) Cells() []Cell

Cells returns a copy of the underlying screen cells

func (*Terminal) Clear

func (t *Terminal) Clear()

Clear clears the terminal moving cursor to 0,0

func (*Terminal) CursorPos added in v0.0.13

func (t *Terminal) CursorPos() (int, int)

GetCursorPos returns the current cursor position in lines, cols

func (*Terminal) DBG

func (t *Terminal) DBG() []byte

DBG Similar to GetScreenAsAnsi but with a cursor

func (*Terminal) DBGStateFn

func (t *Terminal) DBGStateFn() string

DBGStateFn returns the state func name

func (*Terminal) GetScreenAsAnsi

func (t *Terminal) GetScreenAsAnsi() []byte

func (*Terminal) Put

func (t *Terminal) Put(r rune) error

Put processes a single rune in the terminal

func (*Terminal) Resize

func (t *Terminal) Resize(rows, cols int)

func (*Terminal) Updates

func (t *Terminal) Updates() int

Updates returns a sequence number that is incremented every time the screen cells are updated

func (*Terminal) Write

func (t *Terminal) Write(p []byte) (int, error)

Write implements io.Writer and writes the given bytes to the terminal

Jump to

Keyboard shortcuts

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