1mod composite_fit;
5mod crop_writer;
6mod filling;
7mod fit_error;
8mod str_fit;
9mod tbl_fit;
10pub mod wrap;
11
12use {
13 crate::crossterm::{
14 style::{
15 Color,
16 SetBackgroundColor,
17 },
18 QueueableCommand,
19 },
20 minimad::once_cell::sync::Lazy,
21};
22pub use {
23 crate::Error,
24 composite_fit::*,
25 crop_writer::*,
26 filling::*,
27 fit_error::*,
28 str_fit::*,
29 tbl_fit::*,
30};
31
32pub static DEFAULT_TAB_REPLACEMENT: &str = " ";
33
34pub static SPACE_FILLING: Lazy<Filling> = Lazy::new(|| Filling::from_char(' '));
35
36pub fn fill_bg<W>(w: &mut W, len: usize, bg: Color) -> Result<(), Error>
37where
38 W: std::io::Write,
39{
40 w.queue(SetBackgroundColor(bg))?;
41 SPACE_FILLING.queue_unstyled(w, len)?;
42 Ok(())
43}