Documentation
¶
Index ¶
- Variables
- type Cell
- type ColorType
- type ColorValue
- type CropRegion
- type LineWithSequences
- type SGR
- func (s *SGR) ApplyParams(params []int)
- func (s *SGR) Copy() *SGR
- func (s *SGR) Diff(previous *SGR, legacyMode bool) []int
- func (s *SGR) DiffToANSI(previous *SGR, useVGAColors bool, legacyMode bool) string
- func (s *SGR) Equals(other *SGR) bool
- func (s *SGR) Reset()
- func (s *SGR) String() string
- func (s *SGR) ToANSI(useVGAColors bool, legacyMode bool) string
- type SGRSequence
- type Token
- type TokenStats
- type TokenType
- type Tokenizer
- type TokenizerWithStats
Constants ¶
This section is empty.
Variables ¶
var C0Names = map[byte]string{
0x00: "NUL",
0x01: "SOH",
0x02: "STX",
0x03: "ETX",
0x04: "EOT",
0x05: "ENQ",
0x06: "ACK",
0x07: "BEL",
0x08: "BS",
0x09: "HT",
0x0A: "LF",
0x0B: "VT",
0x0C: "FF",
0x0D: "CR",
0x0E: "SO",
0x0F: "SI",
0x10: "DLE",
0x11: "DC1",
0x12: "DC2",
0x13: "DC3",
0x14: "DC4",
0x15: "NAK",
0x16: "SYN",
0x17: "ETB",
0x18: "CAN",
0x19: "EM",
0x1A: "SUB",
0x1B: "ESC",
0x1C: "FS",
0x1D: "GS",
0x1E: "RS",
0x1F: "US",
}
C0 control codes names
var VGAPalette = [16][3]uint8{
{0x00, 0x00, 0x00},
{0xAA, 0x00, 0x00},
{0x00, 0xAA, 0x00},
{0xAA, 0x55, 0x00},
{0x00, 0x00, 0xAA},
{0xAA, 0x00, 0xAA},
{0x00, 0xAA, 0xAA},
{0xAA, 0xAA, 0xAA},
{0x55, 0x55, 0x55},
{0xFF, 0x55, 0x55},
{0x55, 0xFF, 0x55},
{0xFF, 0xFF, 0x55},
{0x55, 0x55, 0xFF},
{0xFF, 0x55, 0xFF},
{0x55, 0xFF, 0xFF},
{0xFF, 0xFF, 0xFF},
}
VGA Palette with exact VGA hardware color values
Functions ¶
This section is empty.
Types ¶
type Cell ¶
Cell represents a single character in the virtual terminal buffer with its associated SGR (Select Graphic Rendition) styling.
type ColorValue ¶
func (ColorValue) IsDefault ¶
func (c ColorValue) IsDefault() bool
func (ColorValue) String ¶
func (c ColorValue) String() string
type CropRegion ¶
type CropRegion struct {
X int // Start X (column)
Y int // Start Y (row)
Width int // Width of region
Height int // Height of region
}
CropRegion defines a rectangular region for cropping. Coordinates are 1-indexed in input, stored as 0-indexed internally.
func ParseCropRegion ¶
func ParseCropRegion(s string) (*CropRegion, error)
ParseCropRegion parses a crop string in format "x,y:x1,y1" (start:end coordinates). Coordinates are 1-indexed (first column/row is 1, not 0). Returns nil if the string is empty.
func (*CropRegion) IsSet ¶
func (c *CropRegion) IsSet() bool
IsSet returns true if the crop region is defined (not nil).
type LineWithSequences ¶
type LineWithSequences struct {
Text string
Sequences []SGRSequence
}
LineWithSequences contains a line of text and all SGR changes within that line
type SGR ¶
type SGR struct {
FgColor ColorValue
BgColor ColorValue
Bold bool
Dim bool
Italic bool
Underline bool
Blink bool
Reverse bool
Hidden bool
Strikethrough bool
}
func (*SGR) ApplyParams ¶
func (*SGR) Diff ¶
Diff returns the minimal set of SGR codes to transition from previous to current state. If previous is nil, returns full state codes. If legacyMode is true, uses [0m + full state when any attribute needs to be turned OFF. If legacyMode is false, uses individual OFF codes (22, 23, 24, etc.).
func (*SGR) DiffToANSI ¶
DiffToANSI generates the minimal ANSI escape sequence to transition from previous to current state. If legacyMode is true, uses [0m + full state when attributes need to be turned OFF (ANSI 1990 compatible). If legacyMode is false, uses individual OFF codes (modern terminals).
type SGRSequence ¶
type SGRSequence struct {
Position int // Position of the character in the line (0-indexed)
SGR *SGR // The SGR sequence to apply from this position
}
SGRSequence represents a SGR style at a specific position in a line
type Token ¶
type Token struct {
Type TokenType `json:"type"`
Pos int `json:"pos"`
Raw string `json:"raw"`
Value string `json:"value,omitempty"`
Parameters []string `json:"parameters,omitempty"`
C0Code byte `json:"c0_code,omitempty"`
C1Code string `json:"c1_code,omitempty"`
CSINotation string `json:"csi_notation,omitempty"`
Signification string `json:"signification,omitempty"`
}
type TokenStats ¶
type TokenStats struct {
TotalTokens int `json:"total_tokens"`
TokensByType map[TokenType]int `json:"tokens_by_type"`
SGRCodes map[string]int `json:"sgr_codes"`
CSISequences map[string]int `json:"csi_sequences"`
C0Codes map[byte]int `json:"c0_codes"`
C1Codes map[string]int `json:"c1_codes"`
TotalTextLength int `json:"total_text_length"`
FileSize int64 `json:"file_size"`
ParsedPercent float64 `json:"parsed_percent"`
PosFirstBadSequence int64 `json:"pos_first_bad_sequence"`
}
type TokenType ¶
type TokenType int
func (TokenType) MarshalJSON ¶
func (*TokenType) UnmarshalJSON ¶
type TokenizerWithStats ¶
type TokenizerWithStats interface {
Tokenizer
GetStats() TokenStats
}
Tokenize with statistics