pub struct AnsiLineAssembler { /* private fields */ }Expand description
Feeds a byte stream into AnsiParser one line at a time, carrying SGR
state across line breaks and holding back incomplete input.
Deliberate limits, not bugs to fix: Attr carries only fg and bg, so
ANSI bold becomes a brighter foreground (that is what AnsiParser
already does) and italic is dropped entirely — plank’s dim-italic
thinking style arrives as its 256-color grey with the italic lost.
Turbo Vision cells have no italic attribute. Also deliberate: the
ERASE_LINE repaint marker (\r\x1b[0K) is detected as a literal
4-byte match anywhere it appears in pending, with no surrounding
context check. Content that happens to quote that exact byte sequence
(a fenced code block showing raw ANSI, a pasted terminal transcript)
would have everything before it on the line silently discarded, same as
a real repaint. This mirrors AnsiParser’s own no-erase-in-line design
and is not worth adding machinery to disambiguate.
Implementations§
Source§impl AnsiLineAssembler
impl AnsiLineAssembler
pub fn new() -> Self
Sourcepub fn take_complete_lines(&mut self) -> Vec<Vec<Cell>>
pub fn take_complete_lines(&mut self) -> Vec<Vec<Cell>>
Removes and returns every line cut so far.
Sourcepub fn partial_line(&self) -> Vec<Cell>
pub fn partial_line(&self) -> Vec<Cell>
The line currently being assembled, rendered as far as it has arrived.
A trailing incomplete escape sequence is withheld, so a half-received
\x1b[3 never appears on screen as literal [3.