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
#[cfg(any(test, doc))]
use crate::*;
#[cfg(not(any(test, doc)))]
use libnotcurses_sys::*;
fn main() -> NcResult<()> {
let nc = unsafe { Nc::new_cli()? };
let splane = unsafe { nc.stdplane() };
splane.set_scrolling(true);
putstrln!(splane, "ENVIRONMENT\n-----------")?;
putstrln!(splane, "notcurses version: {}", Nc::version())?;
putstrln!(splane, "terminal name: {}", nc.detected_terminal())?;
putstrln!(splane, "user name: {}", Nc::accountname())?;
putstrln!(splane, "host name: {}", Nc::hostname())?;
putstrln!(splane)?;
putstrln!(splane, "CAPABILITIES\n------------")?;
putstrln!(
splane,
"Can display UTF-8: {0}
Can display braille characters: {1}
Can display sextant characters: {2}
Can display quadrant characters: {3}
Can display half block characters: {4}
Can open images: {5}
Can open videos: {6}
Supports Pixels: {7}
Supports True Color: {8}
Supports fading: {9}
Supports changing the palette: {10}
Palette size: {11:?}
",
nc.canutf8(),
nc.canbraille(),
nc.cansextant(),
nc.canquadrant(),
nc.canhalfblock(),
nc.canopen_images(),
nc.canopen_videos(),
nc.canpixel(),
nc.cantruecolor(),
nc.canfade(),
nc.canchangecolor(),
nc.palette_size(),
)?;
putstrln!(splane, "GEOMETRY\n------------")?;
let (t_rows, t_cols) = nc.term_dim_yx();
putstrln!(
splane,
"Terminal dimensions: rows={0}, cols={1}",
t_rows,
t_cols
)?;
let pgeom = splane.pixel_geom();
putstrln!(splane, "{:#?}.", pgeom)?;
let vg = nc.visual_geom_with_pixel(None)?;
putstrln!(splane, "{:#?}.", vg)?;
putstrln!(
splane,
"(blitter `{}` = {:?})",
vg.blitter,
vg.blitter_name()
)?;
nc.render()?;
unsafe { nc.stop()? };
Ok(())
}