terminal

package
v0.9.27 Latest Latest
Warning

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

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

Documentation

Overview

Package terminal derives rendered VT frames from raw PTY bytes.

See internal/pty/doc.go for the governing ADR/SPIKE citations that authorize this vt10x-backed emulator wrapper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Char rune
	Mode int16
	FG   uint32
	BG   uint32
}

Cell is one rendered screen cell.

type Clock

type Clock interface {
	Now() time.Time
}

Clock lets tests inject deterministic frame timestamps.

type Cursor

type Cursor struct {
	Row     int
	Col     int
	Visible bool
}

Cursor captures cursor metadata.

type Emulator

type Emulator interface {
	Feed([]byte) (Frame, error)
	Resize(Size) Frame
	Snapshot() Frame
	PendingBytes() []byte
}

Emulator is the internal terminal rendering interface.

type Frame

type Frame struct {
	Seq          uint64
	At           time.Time
	TMS          int64
	Size         Size
	Text         []string
	Cells        [][]Cell
	Cursor       Cursor
	Title        string
	RawStart     int64
	RawEnd       int64
	ParserOffset int64
}

Frame is a deterministic rendered VT snapshot.

type Normalizer

type Normalizer func(Frame) Frame

Normalizer rewrites volatile frame data without mutating raw evidence.

type Option

type Option func(*config)

Option configures New.

func WithClock

func WithClock(clock Clock) Option

WithClock injects a deterministic clock.

func WithNormalizer

func WithNormalizer(n Normalizer) Option

WithNormalizer adds a volatile-content normalization hook.

type Size

type Size struct {
	Rows int
	Cols int
}

Size is a terminal rows/columns pair.

type VT10x

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

VT10x wraps the selected real VT/ANSI emulator backend.

func New

func New(size Size, opts ...Option) *VT10x

New creates a vt10x-backed emulator.

func (*VT10x) Backend

func (v *VT10x) Backend() vt10x.Terminal

Backend returns the wrapped vt10x terminal for low-level diagnostics.

func (*VT10x) Feed

func (v *VT10x) Feed(b []byte) (Frame, error)

Feed writes raw PTY bytes into the emulator and returns the resulting frame.

func (*VT10x) PendingBytes

func (v *VT10x) PendingBytes() []byte

PendingBytes returns incomplete escape/UTF-8 bytes retained for the next feed.

func (*VT10x) Resize

func (v *VT10x) Resize(size Size) Frame

Resize updates the emulator size and returns a new frame.

func (*VT10x) Snapshot

func (v *VT10x) Snapshot() Frame

Snapshot returns the current rendered state.

Jump to

Keyboard shortcuts

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