Skip to main content

sim_view_tty/
caps.rs

1//! Terminal surface capability presets for the tty view/edit surface.
2//!
3//! A surface is described by its advertised [`SurfaceCaps`]; the projection
4//! ranker reads those caps to fit a scene. The `cli` preset is keyboard-only
5//! ANSI; the `tui` preset adds pointer input and a richer palette.
6
7use sim_lib_view::SurfaceCaps;
8
9/// Builds the `cli` surface capabilities with `client_id` set.
10///
11/// A `cli` surface is the baseline keyboard-only ANSI terminal. Panics only if
12/// the built-in `cli` preset is missing, which is a build-time invariant of
13/// [`sim_lib_view::surface`].
14pub fn cli_caps(client_id: &str) -> SurfaceCaps {
15    SurfaceCaps::from_preset("cli", client_id).expect("cli is a built-in surface preset")
16}
17
18/// Builds the `tui` surface capabilities with `client_id` set.
19///
20/// A `tui` surface extends the `cli` baseline with pointer input and a richer
21/// (ansi256) palette. Panics only if the built-in `tui` preset is missing.
22pub fn tui_caps(client_id: &str) -> SurfaceCaps {
23    SurfaceCaps::from_preset("tui", client_id).expect("tui is a built-in surface preset")
24}