mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-26 11:27:10 -06:00
The model's paragraph walk (each_para / each_para_mut) stopped 16 tables down, while a .docx opens with tables nested up to 24 deep and pasting can nest them further. Text box pruning, which runs after every edit, took a box shown only from deeper for one shown nowhere and dropped its story, so an unrelated edit lost the box's text. The same walk decides which boxes a copy takes along and which pasted shapes get stories of their own, and serves reading order, the next drawing id and note conversion. The walk now keeps its own stack instead of recursing, so it reaches every paragraph however deep tables nest, in the same document order and with no call stack to run out of; a paragraph on its own still needs no allocation. The signature is unchanged (the depth argument is now unused), so every caller builds as before. Tests: a box 17 tables down in an opened .docx survives an unrelated edit and a save, while a box shown nowhere still goes; boxes 17 and 40 tables down, in a box and in a header are kept, counted in reading order, and new drawing ids go above the deep shape's; a copied deep table pastes into another document showing its own box's text. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>