adventure: de-wrap transcript into flowing paragraphs
#23 in Riparion/riparion-retro — merged 2026-06-11
Problem
Long room descriptions in Colossal Cave showed the 1977 80-column teletype line breaks baked into advent.dat (rendered literally by white-space: pre-wrap), and consecutive messages had no spacing between them — so prose read like a fixed-width teletype instead of reflowing on a phone.
Change
Presentation-layer only; engine output is untouched.
src/engine/text.rs— newreflow(s)(sibling tomodernize, which is unchanged). Splits an output block into paragraphs on blank lines and joins wrap-residue lines back into flowing prose. The discriminator is line width (WRAP_THRESHOLD = 50): long lines were wrapped → rejoin with a space; short or indented lines were deliberate → keep the break. So:- room descriptions reflow to the viewport,
- inventory lists stay one item per line,
- centered dividers (
- - -,--- POOF!! ---) keep their leading spaces.
src/ui/components/transcript.rs— renders one<p class="t-out">per paragraph (was one<p>per block) for visible paragraph spacing.assets/main.css— keepspre-wrap(surviving list/divider breaks render; prose reflows), bumps bottom margin to0.7rem.
Tests
cargo test -p adventure — all 28 pass, including the four walkthrough golden masters. Those compare content with whitespace normalized, so line-break changes are invisible to them; modernize's newline test is unaffected since modernize is unchanged. Added 4 unit tests for reflow (de-wrap, inventory, divider, paragraph split).
🤖 Generated with Claude Code
Last updated 2026-06-12
Links to this note
Merged pull requests, newest first.