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
//! A minimal, crossterm-based terminal text viewer for Rust.
//!
//! Wrap any text with [`TxtView::new`], optionally tune it with
//! [`TxtViewConfig`], then call [`TxtView::run`]. The viewer takes over the
//! terminal with an alternate screen, switches to raw mode, and restores the
//! previous screen and settings when the user quits.
//!
//! [`TxtView::run`] blocks for the whole session and requires an interactive
//! terminal, so a small program is all it takes:
//!
//! ```no_run
//! # use txtview::TxtView;
//! # fn main() -> std::io::Result<()> {
//! let mut viewer = TxtView::new("hello world");
//! viewer.run()
//! # }
//! ```
//!
//! # Styled text
//!
//! The content is written verbatim, so ANSI colors and styling pass through
//! unchanged. Build styled lines with crossterm's `style` module and feed
//! them straight into [`TxtView::new`].
//!
//! # Configuration
//!
//! [`TxtViewConfig`] controls the display: line numbers, the help bar, the
//! interactive scrollbar, and a fixed viewport size. Configure it with a struct
//! literal plus `..TxtViewConfig::default()`, or chain the `with_*` setters.
//! See its documentation for examples.
pub use TxtView;
pub use TxtViewConfig;