mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-10 12:21:54 +00:00
Each command a script runs keeps a savepoint of the state it may need to put back if it fails. The savepoint cloned every open document's whole undo history, so a script that made N edits did O(N^2) work. - The savepoint now clones each document's state without its history and keeps a mark: the newest undo and redo steps and the serials of the steps under them. Until the command ends, the history trims no step, and a new step sets the redo steps aside instead of dropping them. A failed command truncates both stacks back to the mark. - file.close, file.closeAll, document.close and file.revert still keep a whole copy, since they remove the history or the document. - When a failed command removed or changed a step under the newest one, the history cannot be put back exactly, and the run stops with an error; its rollback restores the documents as they were before the run. - run_guarded no longer copies the histories during a script's run, and a committed run moves the histories from before it back instead of copying them. - Symbol editing mode shares its saved redo steps between copies of a document's state. - A script cannot run edit.clearHistory. A run keeps each document's undo steps from before it, so the command reported a clear that the commit then undid.