1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Copyright © Fangdun Tsai <fundon@pindash.io>
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Zero-allocation, panic-free DEC VT500 terminal parser with UTF-8 decoding
//! and `no_std` support.
//!
//! ## Usage
//!
//! ```rust,ignore
//! use vtty::{Parser, Perform};
//!
//! struct Screen;
//!
//! impl Perform for Screen {
//! fn print_bytes(&mut self, s: &[u8]) { /* printable ASCII run */ }
//! fn print(&mut self, c: char) { /* non-ASCII code point */ }
//! fn execute(&mut self, b: u8) { /* \n \t \x1b … */ }
//! fn csi_dispatch(&mut self, params: &[i32], sep: u16, intermediates: &[u8], final_byte: u8) {
//! /* CSI Ps ; Ps final */
//! }
//! fn osc_dispatch(&mut self, params: &[&[u8]], bell: bool) { /* OSC */ }
//! }
//!
//! let mut parser = Parser::new();
//! parser.advance(&mut screen, b"\x1b[1;31mhello\x1b[0m");
//!
//! // With the `simd-transcode` feature enabled, opt into SIMD scanning,
//! // validation and UTF-8→UTF-32 transcode:
//! let mut parser = Parser::with_simd();
//! parser.advance(&mut screen, b"\x1b[1;31mhello\x1b[0m");
//! ```
//!
//! Also available: `Event`/`Recording` (owned enum API), `State` (byte-cursor
//! sink with line/cursor geometry), `Reply` (query reply builder), and
//! `ColorId`, `SgrFlags`, `TermFlags`, `KittyFlags`, `MouseButton`, `Charset`, `Cap`.
//!
//! ## Design
//!
//! - **Panic-free** — `#![forbid(unsafe_code)]`; malformed PTY input never
//! crashes.
//! - **Zero-allocation hot path** — one `print_bytes` per ASCII run, one
//! `print_codepoints` per non-ASCII run; CSI/OSC/DCS state is inline.
//! - **`no_std` by default** — optional `simd` (scanning + validation) and
//! `simd-transcode` (UTF-8→UTF-32) features, enabled per parser.
//! - **W3C-correct UTF-8** — maximal-subpart substitution; 8-bit clean
//! (DEC “anywhere”).
//!
//! ## Test
//!
//! ```bash
//! cargo test -p vtty
//! cargo test -p vtty --test vt_differential -- --nocapture # parity vs vte
//! ```
// The parser must never panic on untrusted input (a malformed PTY stream is
// normal, not exceptional). These lints keep `unwrap`/`expect`/`panic` out.
extern crate alloc;
pub use ;
pub use ;
pub use ;
pub use KittyFlags;
pub use ;
pub use ;
pub use Parser;
pub use Perform;
pub use ;
pub use Reply;
pub use State;
pub use ;
pub use ;