Skip to main content

uncurses/ansi/
mod.rs

1//! ANSI and terminal-control sequence subsystem.
2//!
3//! ## Scope
4//!
5//! The modules under `ansi` are the byte-level building blocks used to emit,
6//! parse, measure, strip, truncate, and wrap terminal control streams. They cover
7//! cursor motion, screen editing, modes, SGR styling, OSC metadata, DCS/APC
8//! payloads, C0/C1 controls, and ANSI-aware text utilities.
9//!
10//! ## Sequence families
11//!
12//! Most writers emit 7-bit forms because they are broadly accepted on byte
13//! streams that are otherwise UTF-8 text:
14//!
15//! ```text
16//! CSI: ESC [ params intermediates final      e.g. ESC [ ? 2048 h
17//! OSC: ESC ] command ; payload BEL|ST        e.g. ESC ] 2 ; title ESC \\
18//! DCS: ESC P params payload ST               e.g. ESC P + q 524742 ESC \\
19//! APC: ESC _ command payload ST              e.g. ESC _ G ... ESC \\
20//! ```
21//!
22//! Anatomy of a DEC private mode sequence:
23//!
24//! ```text
25//! ESC [  ?  2 0 4 8  h        CSI ? 2048 h  (enable mode 2048)
26//! ──┬── ─┬─ ───┬──── ┬
27//!  CSI  priv  params final
28//! ```
29//!
30//! ## 7-bit and 8-bit controls
31//!
32//! The constants in [`c0`] and [`c1`] name single-byte controls. Parser utilities
33//! recognize both the 7-bit `ESC` spellings and the 8-bit C1 bytes, while writer
34//! functions generally choose explicit 7-bit byte strings.
35//!
36//! ## Mode interaction
37//!
38//! Mode-aware features are represented by [`mode::Mode`]. Enable or disable
39//! modes with [`mode::write_set_mode`] and [`mode::write_reset_mode`] before
40//! expecting mode-controlled reports such as bracketed paste, focus events,
41//! in-band resize, or light/dark notifications.
42//!
43//! ## Example
44//!
45//! ```rust,ignore
46//! use uncurses::ansi::title::write_window_title;
47//!
48//! let mut out = Vec::new();
49//! write_window_title(&mut out, "my app")?; // ESC ] 2 ; my app ESC \\
50//! # Ok::<(), std::io::Error>(())
51//! ```
52
53pub mod ascii;
54pub mod c0;
55pub mod c1;
56pub mod charset;
57pub mod clipboard;
58pub mod color;
59pub mod cost;
60pub mod ctrl;
61pub mod cursor;
62pub mod cwd;
63pub mod finalterm;
64pub mod focus;
65pub mod graphics;
66pub mod hyperlink;
67pub mod inband;
68pub mod iterm2;
69pub mod keypad;
70pub mod kitty;
71pub mod mode;
72pub mod notification;
73pub mod palette;
74pub mod params;
75pub mod passthrough;
76pub mod paste;
77pub mod progress;
78pub mod screen;
79pub mod sgr;
80pub mod status;
81pub mod strip;
82pub mod termcap;
83pub mod text;
84pub mod title;
85pub mod truncate;
86pub mod urxvt;
87pub mod winop;
88pub mod wrap;
89pub mod xterm;