fix(reader): Keep diagrams after quick resizes, and add width keys
Refs #46.
Diagrams vanishing on resize
After several resizes in a row (dragging a pane edge), Rex drops the uploaded kitty images. Leaf kept placing the old ids, which showed nothing and left an empty gap. A resize now frees and re-uploads every figure (App::resized).
Checked in Rex 0.1.0-preview.20 by toggling pane zoom 7ā12 times on a short Mermaid diagram: the old build lost the diagram 2/2 times, this build kept it 2/2.
Reading width keys
</>narrow or widen the column by 8 columns (minimum 20).=fits the column to the screen, and again returns toreader.max_width.
Changes last for the session. The pen and eraser now share a row in the ? list so quit still fits on a 30-row screen.
Screenshots (Rex)
Pane zoom toggled 12 times on a short Mermaid diagram.
| Before: diagram gone | After: diagram kept |
|---|---|
![]() | ![]() |
= fits the column to the pane, so the sequence diagram from #46 is readable:

Tests
a_resize_uploads_figures_again_because_terminals_may_drop_themangle_brackets_narrow_and_widen_the_column_and_equals_fits_the_screencargo test: all pass.cargo clippy: same 5 existing warnings.
š¤ Generated with Claude Code
Summary by cubic
Fixes diagrams and ink vanishing after several quick resizes by re-uploading them on every resize, and adds </> to narrow or widen the reading column plus = to fit it to the screen (pressing = again returns to the configured max_width). Width keys pressed before the next frame each count toward the new width, and the pen and eraser now share a row in the key list so quit still fits on short screens.

