AnsiByteBreakdown class

UTF-8 byte counts for emitted ANSI output, split by what the bytes were spent on.

"Bytes on the wire" are measured as UTF-8 because that is what the terminal (and any SSH/tmux transport) actually carries — escape sequences are ASCII (one byte per character), but content graphemes can be multi-byte (CJK, emoji). Counting UTF-16 code units would undercount real transport cost.

Categories map to what AnsiRenderer emits:

  • content: printable graphemes (the actual information).
  • sgr: CSI … m — style set/reset (color, bold, reverse, …).
  • cursor: CSI cursor moves/positioning (A/B/C/D, H/f, and related row/column positioning commands).
  • sync: CSI ? 2026 h/l — the per-frame synchronized-output wrapper.
  • session: session lifecycle private-mode toggles — alt screen (1049), cursor visibility (25), bracketed paste (2004), mouse modes (1000/1002/1003/1006), and Kitty keyboard push/pop (CSI > … u / CSI < u). Paid once per enter/suspend/restore, not per frame.
  • other: any other escape sequence (an unrecognized CSI final, or a non-image OSC like clipboard 52 / hyperlink 8).
  • image: inline-image protocol payloads — Kitty graphics (APC ESC _ G … ST), Sixel (DCS ESC P … ST, also the tmux image-passthrough envelope), and iTerm2 (OSC ESC ] 1337 ; … BEL/ST). The dominant per-frame payload on image frames; counted as payload (like content), NOT tunable overhead.

Constructors

AnsiByteBreakdown({int content = 0, int sgr = 0, int cursor = 0, int sync = 0, int session = 0, int other = 0, int image = 0})
const
AnsiByteBreakdown.analyze(String data)
Categorizes a single emitted ANSI string by UTF-8 byte count.
factory

Properties

content → int
final
cursor → int
final
hashCode → int
The hash code for this object.
no setterinherited
image → int
final
other → int
final
overhead → int
Bytes that carry information (content) vs. control/formatting overhead spent per frame (everything except content and session). A high overhead fraction on update frames is the signal that byte-level encoding (e.g. incremental SGR) is worth tuning. Session lifecycle bytes are excluded: they are connection setup/teardown, paid once per terminal enter/restore, and would otherwise dominate the fraction on short runs without saying anything about frame encoding.
no setter
overheadFraction → double
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
session → int
final
sgr → int
final
sync → int
final
total → int
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object>
toString() → String
A string representation of this object.
override

Operators

operator +(AnsiByteBreakdown o) → AnsiByteBreakdown
operator ==(Object other) → bool
The equality operator.
inherited