Headless dumps and captures
Draw the app at any size after a list of keys, with no terminal.
What it does
Tui::shot draws the app at any size after a list of keys, dump::text and dump::ansi print it, Tui::bench times every screen, and capture::capture and capture::compare record every cell of every screen before a big change and report each cell that moved after it.
Time comes from the run, never the wall clock: drawing reads the loop's moment, and Tui::advance moves the run's clock, so the same app gives the same frames. The app wires them to its own flags, as the demo does with --dump, --keys, --bench, --capture and --compare.
-
A dump at any size
One key, a 72x14 dump, printed as text.
$ cargo run --release --example demo -- --dump 72x14 --keys "tab" ──────────────────────────────── demo ──────────────── workspace one ─ 1 Home 2 What to do next 3 Log 5 steps ─ What to do next ──────────────────────────────────────────────────── Step How ▌ Replace this screen Home and Next are two Screen types; s… Set your accent Tui::new takes one colour, or Palette… Add your first command a key in Screen::key, its work in Cx:… Load real data Screen::load returns the read; Screen… Wire the headless flags --dump, --keys, --at, --bench, --capt… ────────────────────────────────────────────────────────────────────── ↑↓ move · enter open · / filter · ctrl+k go to · ctrl+c twice quit -
Frames before and after
capture::capturewalks every screen, and the app's key scripts for deeper states, at a list of sizes, and saves every cell, its symbol, colours and modifiers.capture::comparewalks the same again and reports each cell that differs, by screen, size and position. Capture, change, compare, and delete the captures. -
A bench in the box
Tui::benchdraws each screen 1,000 times into an in-memory terminal, the whole shell each time, moving the clock a frame at a time. It is how the frame times on the Speed page were taken. -
No commands spawned
Headless runs never spawn a command, and a stop there marks a queued one stopped, so a dump never starts real work.
Measured
- a frame, the mean of 1,000
Tui::benchdraws of each demo screen, measured on pito-tui 0.4.1, which draws with the same code as 1.0.0 - 0.07–0.31 ms
- How it was measured
How to use it
-
Dump the demo at 100x24 after three keys.
cargo run --release --example demo -- --dump 100x24 --keys "tab down enter" -
Time every screen, 1,000 draws each.
cargo run --release --example demo -- --dump 120x34 --bench 1000