22 releases (11 breaking)

0.12.0 Mar 9, 2021
0.10.0 Mar 7, 2021
0.8.1 Feb 9, 2020
0.8.0 Dec 7, 2019
0.1.2 Jun 4, 2016

#61 in Command-line interface

Download history 19/week @ 2021-02-25 107/week @ 2021-03-04 31/week @ 2021-03-11 14/week @ 2021-03-18 117/week @ 2021-03-25 31/week @ 2021-04-01 49/week @ 2021-04-08 175/week @ 2021-04-15 48/week @ 2021-04-22 39/week @ 2021-04-29 12/week @ 2021-05-06 38/week @ 2021-05-13 11/week @ 2021-05-20 14/week @ 2021-05-27 20/week @ 2021-06-03 46/week @ 2021-06-10

240 downloads per month
Used in 3 crates

MIT license

555KB
3K SLoC

vt100

This crate parses a terminal byte stream and provides an in-memory representation of the rendered contents.

Overview

This is essentially the terminal parser component of a graphical terminal emulator pulled out into a separate crate. Although you can use this crate to build a graphical terminal emulator, it also contains functionality necessary for implementing terminal applications that want to run other terminal applications - programs like screen or tmux for example.

Synopsis

let mut parser = vt100::Parser::new(24, 80, 0);

let screen = parser.screen().clone();
parser.process(b"this text is \x1b[31mRED\x1b[m");
assert_eq!(
    parser.screen().cell(0, 13).unwrap().fgcolor(),
    vt100::Color::Idx(1),
);

let screen = parser.screen().clone();
parser.process(b"\x1b[3D\x1b[32mGREEN");
assert_eq!(
    parser.screen().contents_formatted(),
    &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jthis text is \x1b[32mGREEN"[..],
);
assert_eq!(
    parser.screen().contents_diff(&screen),
    &b"\x1b[1;14H\x1b[32mGREEN"[..],
);

Dependencies