Variables: an import or library load that changes nothing adds no undo step

dataset.import and variable.loadLibrary added an undo step, cleared Redo
and marked a saved document modified even when the variables and data
sets came out as they were, such as the same CSV or library loaded
again. Both now build the new variables on a copy and record a step only
when it differs. variable.loadLibrary's params text and docs/mcp.md say
so.
This commit is contained in:
dotCooCoo
2026-11-02 12:03:45 +07:00
committed by bflatastic
parent d0749dde41
commit a6ce22da5c
5 changed files with 89 additions and 24 deletions
+2 -1
View File
@@ -1652,7 +1652,8 @@ already walks Image Trace. Short agent entry points:
reply's `defined` lists the variables the import defined. While the variables are
locked, an import whose header would define a variable fails with "variables are locked".
- Variable libraries: `variable.loadLibrary {path|xml|dataBase64}` (the Variables panel menu's Load Variable
Library…) replaces the document's variables and data sets with a variable library's in one undo step. The library
Library…) replaces the document's variables and data sets with a variable library's in one undo step. A load, like a
`dataset.import`, adds no undo step when it leaves the variables and data sets as they were. The library
is XML whose `variableSets` element holds `variableSet` elements, each with a `variables` element of `variable`
elements (`varName`, `trait`) and a `sampleDataSets` element of `sampleDataSet` elements (`dataSetName`). Every
variable of the document is deleted with its bindings and values, and every data set is deleted. Then the library's