vt100_psmux/lib.rs
1#![allow(dead_code)]
2//! This crate parses a terminal byte stream and provides an in-memory
3//! representation of the rendered contents.
4//!
5//! # Overview
6//!
7//! This is essentially the terminal parser component of a graphical terminal
8//! emulator pulled out into a separate crate. Although you can use this crate
9//! to build a graphical terminal emulator, it also contains functionality
10//! necessary for implementing terminal applications that want to run other
11//! terminal applications - programs like `screen` or `tmux` for example.
12//!
13//! # Synopsis
14//!
15//! ```
16//! # use vt100_psmux as vt100;
17//! let mut parser = vt100::Parser::new(24, 80, 0);
18//!
19//! let screen = parser.screen().clone();
20//! parser.process(b"this text is \x1b[31mRED\x1b[m");
21//! assert_eq!(
22//! parser.screen().cell(0, 13).unwrap().fgcolor(),
23//! vt100::Color::Idx(1),
24//! );
25//!
26//! let screen = parser.screen().clone();
27//! parser.process(b"\x1b[3D\x1b[32mGREEN");
28//! assert_eq!(
29//! parser.screen().contents_formatted(),
30//! &b"\x1b[?25h\x1b[m\x1b[H\x1b[Jthis text is \x1b[32mGREEN"[..],
31//! );
32//! assert_eq!(
33//! parser.screen().contents_diff(&screen),
34//! &b"\x1b[1;14H\x1b[32mGREEN"[..],
35//! );
36//! ```
37
38#![warn(missing_docs)]
39#![warn(clippy::cargo)]
40#![warn(clippy::pedantic)]
41#![warn(clippy::nursery)]
42#![warn(clippy::as_conversions)]
43#![warn(clippy::get_unwrap)]
44#![allow(clippy::cognitive_complexity)]
45#![allow(clippy::missing_const_for_fn)]
46#![allow(clippy::similar_names)]
47#![allow(clippy::struct_excessive_bools)]
48#![allow(clippy::too_many_arguments)]
49#![allow(clippy::too_many_lines)]
50#![allow(clippy::type_complexity)]
51
52mod attrs;
53mod callbacks;
54mod cell;
55mod grid;
56mod parser;
57mod perform;
58mod row;
59mod screen;
60mod term;
61
62pub use attrs::Color;
63pub use callbacks::Callbacks;
64pub use cell::Cell;
65pub use parser::Parser;
66pub use screen::{MouseProtocolEncoding, MouseProtocolMode, Screen};