ansi

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ansi provides shared ANSI/DEC terminal emulation for concrete terminal profiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile uint8

Profile selects a concrete set of terminal behavior.

const (
	VT220 Profile = iota
	XTerm
)

type Terminal

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

Terminal is the shared ANSI/DEC emulation engine.

func New

func New(width, height int, profile Profile) (*Terminal, error)

New creates a terminal engine for profile.

func (*Terminal) DrainEvents

func (t *Terminal) DrainEvents() []tuicast.TerminalEvent

DrainEvents returns and clears terminal control events produced by Write.

func (*Terminal) EncodeKey

func (t *Terminal) EncodeKey(key tuicast.Key) ([]byte, error)

EncodeKey returns the input sequence for a named key.

func (*Terminal) EncodeKeyPress

func (t *Terminal) EncodeKeyPress(press tuicast.KeyPress) ([]byte, error)

EncodeKeyPress returns the input sequence for a key and its modifiers.

func (*Terminal) Profile

func (t *Terminal) Profile() tuicast.TerminalProfile

Profile returns the terminal behavior being emulated.

func (*Terminal) Resize

func (t *Terminal) Resize(width, height int) error

Resize changes the terminal dimensions while preserving each buffer's overlapping upper-left region.

func (*Terminal) SetAnswerback

func (t *Terminal) SetAnswerback(answerback string) error

SetAnswerback configures the printable response to an ENQ control. DEC terminals limit the answerback message to 20 bytes.

func (*Terminal) Snapshot

func (t *Terminal) Snapshot() tuicast.Screen

Snapshot returns state detached from subsequent terminal updates.

func (*Terminal) Write

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

Write applies host output to the terminal.

Jump to

Keyboard shortcuts

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