Expand description
Input recording & replay for retroglyph.
Two things live here, both built on retroglyph-core’s testing feature
(retroglyph_core::testing::InputRecording/TestHarness):
InputRecorder: wraps anyBackendand taps its input stream, so a real session (a bug report, a demo run) can be captured to a.rgrecfile viaInputRecorder::save.replay_live: drives a saved recording forward into a liveTerminal/App, once, at recorded pace – “watch it happen” on screen. For driving a recording back through a headlessAppin a test instead (no real backend, no wall-clock sleeping), useTestHarness::replaydirectly.
install_panic_recorder wires a RecorderHandle into std::panic’s hook, so an
in-progress recording is saved automatically if the process panics instead of being lost.
A different pair records “what was shown” instead of “what happened”:
FrameRecorder: wraps anyOutputbackend and taps itsDrawCelldiff stream, buffering ownedCapturedFrames.write_cast: exports those frames as asciicast v3 newline-delimited JSON, so the existing external ecosystem (agg,asciinema-player,svg-term) renders it – retroglyph never builds a GIF encoder or an interactive player of its own.
With the pty feature, pty::capture_pty is a second capture source for the same
write_cast path: it drives a real backend under a real pseudo-terminal (rather than a
TestHarness-style synthetic Headless), aiming for the fidelity a real-terminal tool like
vhs gets from a real terminal emulator, without one in this crate’s own dependency tree.
Not here: a first-class cross-backend replay helper for frame recordings (standard asciicast
output already covers the common case), or embedding asciinema-player in the docs site
(straightforward once there’s a concrete need) – both deliberately deferred, see
retroglyph#1268.
§Features
This crate has no default features; every feature below is optional and off unless enabled.
§pty
⚪ Optional.
A real-pseudo-terminal capture source (pty::capture_pty) feeding the same write_cast path
FrameRecorder does, for vhs-like real-terminal fidelity. Adds portable-pty/vt100.
Modules§
- pty
capture_pty: a real-pseudo-terminal capture source, behind theptyfeature.
Structs§
- Captured
Frame - One changed frame: every cell
Output::draw_layersreported changed on that call, with the wall-clock time sinceFrameRecorder::new. - Frame
Recorder - Wraps a backend and records every frame it draws.
- Frame
Recorder Handle - A cheap, cloneable handle onto a
FrameRecorder’s captured frames. - Input
Recorder - Wraps a backend and records every event it sees.
- Owned
Cell - An owned copy of a single
DrawCell, the shapeFrameRecorderbuffers instead of the borrowed original. - Recorder
Handle - A cheap, cloneable handle onto an
InputRecorder’s captured state.
Functions§
- install_
panic_ recorder - Installs a panic hook that saves whatever
handle’s recorder has captured so far topathwhen the process panics, then chains to whatever hook was already installed. - read
- Reads a
.rgrecfile written bywrite()back into anInputRecording. - replay_
live - Drives
recordingintoappthrough a liveterm, once, at recorded pace. - write
- Writes
recordingtopathas.rgrec, overwriting any existing file. - write_
cast - Exports
framesas asciicast v3 newline-delimited JSON, written towriter.