TerminalText
Output written for a terminal, as a terminal shows it: the control functions of ECMA-48 (ISO/IEC 6429, "ANSI escape codes") in the subset xterm-compatible programs use for their output, applied to a screen of lines with a cursor.
C0 controls:
\n(new line),\r(back to the start of the line, so progress bars redraw in place),\b(back one column),\t(tab stops every 8 columns); others are dropped.CSI: SGR
m(bold, dim, italic, underline, blink as nothing, inverse, conceal, strike, the 16 colors and their bright forms, 256-color38;5;nand true color38;2;r;g;b, in;or:form, foreground and background); erase in lineKand in displayJ; cursor up / down / forward / backABCD, next / previous lineEF, columnG, positionH/f(rows relative to the first line of the output). Private modes (?25l…) and the rest are ignored.OSC:
8hyperlinks (OSC 8, as in iTerm2, GNOME Terminal and Windows Terminal) become Style.link; other OSC strings (window titles…) are dropped. Other escape sequences are dropped.
UI elements render lines with their styles; plain is what the terminal would show as text, e.g. for a model, which should not pay for escape codes and redrawn progress bars.
Types
A run of text with one style.
How text is drawn; null colors are the terminal's defaults.