termemu

package
v1.3.13 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const SeqEsc = "\x1b"
View Source
const SeqEscCsi = SeqEsc + "["
View Source
const SeqEscO = SeqEsc + "O"

Variables

View Source
var TermEnv = []string{

	"TERM=xterm-256color",
	"COLORTERM=truecolor",
}

Functions

func XTerm256Color

func XTerm256Color(n int) color.Color

Types

type Attr

type Attr struct {
	Fg      TermColor
	Bg      TermColor
	Bold    bool
	Inverse bool // inverse fg/bg
}

type Cell

type Cell struct {
	R rune
	A Attr
}

type Emu

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

func NewEmu

func NewEmu(userRw io.ReadWriter, tui Tui, opts Opts) *Emu

emu itself is a read/write to be passed to the executable, wrapping the UI that is a rwc as well

func (*Emu) ClampSize

func (emu *Emu) ClampSize(p P) P

func (*Emu) Close

func (emu *Emu) Close() error

func (*Emu) GetSize

func (emu *Emu) GetSize() P

func (*Emu) NeedsPaint

func (emu *Emu) NeedsPaint()

func (*Emu) Read

func (emu *Emu) Read(p []byte) (int, error)

func (*Emu) ScrPrivModes

func (emu *Emu) ScrPrivModes() *PrivModes

func (*Emu) SetSize

func (emu *Emu) SetSize(p P) (P, bool)

func (*Emu) Snapshot

func (emu *Emu) Snapshot() *Screen

func (*Emu) Write

func (emu *Emu) Write(p []byte) (int, error)

type Graphics

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

type Grid

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

type GridLine

type GridLine struct {
	Wrapped bool // Proprietary editor mode only: if true, next line is logical continuation of this one.
	// contains filtered or unexported fields
}

func (*GridLine) Clone

func (gl *GridLine) Clone() GridLine

type Mode

type Mode int
const (
	ModeOff   Mode = iota // no VT emulation
	ModeRaw               // VT emu for replies; present raw bytes
	ModePlain             // VT emu; present printable runes only
	ModeGrid              // VT emu; present rendered text grid
)

func (Mode) IsGrid

func (m Mode) IsGrid() bool

func (Mode) On

func (m Mode) On() bool

func (*Mode) SetBool

func (m *Mode) SetBool(m2 Mode, v bool)

type Opts

type Opts struct {
	Mode  Mode
	Debug bool
}

type P

type P = image.Point // 0-based

func ClampMinValidGridSize

func ClampMinValidGridSize(p P) P

func MinValidGridSize

func MinValidGridSize() P

type PrivModes

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

PrivModes keeps DEC private modes (?n).

func (*PrivModes) AlternateBuffer

func (m *PrivModes) AlternateBuffer() bool

func (*PrivModes) AnsiNotVT52

func (m *PrivModes) AnsiNotVT52() bool

func (*PrivModes) AppCursorKeys

func (m *PrivModes) AppCursorKeys() bool

func (*PrivModes) BracketedPaste

func (m *PrivModes) BracketedPaste() bool

func (*PrivModes) LineFeedNewline

func (m *PrivModes) LineFeedNewline() bool

func (*PrivModes) SynchronizedOutput

func (m *PrivModes) SynchronizedOutput() bool

type R

type R = image.Rectangle // r.Max exclusive

type SaveCursor

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

type Screen

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

func NewScreen

func NewScreen() *Screen

func (*Screen) Bprint

func (scr *Screen) Bprint(cursor bool) []byte

bytes print

func (*Screen) Clone

func (s *Screen) Clone() *Screen

func (*Screen) IsCursor

func (s *Screen) IsCursor(x, y int) bool

func (*Screen) Print

func (scr *Screen) Print()

useful for debug

func (*Screen) PrintWithCursor

func (scr *Screen) PrintWithCursor()

func (*Screen) Qprint

func (scr *Screen) Qprint(cursor bool) string

quoted print

func (*Screen) Sprint

func (scr *Screen) Sprint(cursor bool) string

type ScreenPrinter

type ScreenPrinter struct {
	ColorFn func(offset int, fg, bg TermColor, inverse bool)
	SepFn   func(offset int)

	CursorRune rune // mostly for testing where there are no colors, so a rune is printed for guidance
	// contains filtered or unexported fields
}

func NewScreenPrinter

func NewScreenPrinter() *ScreenPrinter

func (*ScreenPrinter) Bprint

func (sp *ScreenPrinter) Bprint(scr *Screen) []byte

type TermColor

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

func NewTermColorIndexed

func NewTermColorIndexed(n int) TermColor

func NewTermColorRGB

func NewTermColorRGB(r, g, b uint8) TermColor

func (TermColor) Index

func (tc TermColor) Index() int

func (TermColor) IsDefault

func (tc TermColor) IsDefault() bool

func (TermColor) Kind

func (tc TermColor) Kind() TermColorKind

func (TermColor) RGBA

func (tc TermColor) RGBA() color.RGBA

type TermColorKind

type TermColorKind uint8
const (
	TermColorDefault TermColorKind = iota
	TermColorIndexed
	TermColorRGB
)

type TermCsiOp

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

func (*TermCsiOp) A

func (op *TermCsiOp) A() int

func (*TermCsiOp) ADef

func (op *TermCsiOp) ADef(def int) int

func (*TermCsiOp) B

func (op *TermCsiOp) B() int

func (*TermCsiOp) BDef

func (op *TermCsiOp) BDef(def int) int

type TermOp

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

type Tui

type Tui interface {
	OnColumnModeChange()
	Paint()
	Print(any)
	Error(error)
}

terminal user interface

type VTParser

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

func NewVTParser

func NewVTParser(r io.Reader, emit func(*TermOp)) *VTParser

func (*VTParser) Run

func (p *VTParser) Run() error

Jump to

Keyboard shortcuts

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