mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-30 13:46:47 -06:00
Inputs, the output and a Repeat's range were bound once, by sheet index and coordinates. A step that inserted a sheet in front of an input's sheet sent every later token to the new sheet, and rows inserted above an input left the tokens on the cells that moved into its place; the run wrote into the wrong cells and reported success. - Commands record the structural edits they make as they rewrite references (`Ctx::edits`; while a macro step runs, `DocState::edits` collects them). - After each step the machine matches the sheets as the run's guard does and moves the inputs, the output and the ranges of the Repeats in progress by those edits, with the formula engine's own adjustment. - A step that deletes an input's or the output's cells, or their sheet, or changes the size of a range a Repeat is going over, stops the run, which rolls back. - Test: `inputs_and_the_output_follow_their_cells_when_a_step_moves_them` (a sheet inserted in front, rows inserted above, an input deleted, a Repeat's range grown).