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.
Since turbo-vision 2.2, Attr carries a style bitset alongside fg/bg,
so ANSI bold, dim, italic, underline, reverse, and strikethrough survive
parsing and are re-emitted by attr_to_sgr to carry across line breaks —
plank’s dim-italic thinking style now arrives italic, not just as its grey.
(ANSI bold still also brightens the foreground; that is AnsiParser’s own
behavior.) Deliberate, not a bug: 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.