mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-27 03:46:50 -06:00
StyleRun start/end are usize taken straight from a .figcraft document.json (nothing clamps them on load; only the REST and SVG importers normalize), so TextData::replace_range's p - removed + inserted panics in a debug or test build and wraps to zero in release, where normalize then drops the run and the layer silently loses its formatting. Shift the runs with saturating arithmetic; normalize drops whatever is left. Regression test: text_runs_past_the_text_never_overflow — panics at crates/doc/src/text.rs:605 on main, passes with the clamp.