Refuse or carry the edits a re-read would undo - #20
Merged
Conversation
Four findings from a test sweep of the unified table-edit path, all one
shape: the table accepted an edit, showed it, and the next read of the
file spelled something else.
Renaming a catalogued Architectural Data entry demoted it. System
Composer keeps its type catalog in a SEPARATE part of the dictionary
that references entries BY NAME — a JSON object in a textual .sldd, a
zipped MF0 XML member in a compressed-binary one — so a rename left the
catalog defining a name nothing carries: a struct type re-read as a
plain data interface, on both formats, in the file. ScCatalog.ts now
holds that vocabulary in one place; a section moves the key when one of
its entries is renamed (_entryRenamed), which is what keeps a narrow
repaint honest, since rebuilding an entry from a record classifies it
through the catalog. The scan/rename/apply helpers are exported because
patching the FILE belongs to the host: it owns the open document's text
and the zip members, and this package can splice neither for it.
Renaming a struct, object or .mat struct array left its elements
labelled after the old name. The label was baked at parse time; it is
now derived from an ElementSubscript and the parent's CURRENT displayed
name, so an element row follows the row above it at any depth.
A Simulink.Parameter's Value row offered a rename that serialize
discarded in silence: the property is written under the key `Value`
whatever the node is called. That row is a class property bag exactly as
an object's children are, so it says so, and setProperty asks
nameEditable before renaming anything — the model no longer accepts a
rename the table already declined to offer.
A Description typed onto a plain variable or a struct went nowhere:
those serialize as {name, metadata, value}, with no property bag to hold
one. `descriptionEditable` joins the nameEditable/valueEditable family —
declared true, false in the two classes that cannot keep one — and is
consulted by the row, by the property inspector, and by setProperty.
Refusing an edit and carrying it are the same rule from two sides: what
the cell shows is what the file will say.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four findings from a test sweep of the unified table-edit path, all one shape: the
table accepted an edit, showed it, and the next read of the file spelled something
else.
keeps its type catalog in a separate part of the dictionary that references entries
by name (a JSON object in a textual
.sldd, a zipped MF0 XML member in acompressed-binary one), so a rename left the catalog defining a name nothing carries
and a struct type re-read as a plain data interface — in the file, on both formats.
New
parser/ScCatalog.tsholds that vocabulary;SectionNode._entryRenamedmoves thekey in memory (load-bearing for a narrow repaint, which rebuilds an entry from a
record and classifies it through the catalog), and the scan/rename/apply helpers are
exported so the host can patch the file — it owns the document text and the zip
members; this package can splice neither.
old name. The label was baked at parse time; it is now derived from an
ElementSubscriptplus the parent's current displayed name.Simulink.Parameter'sValuerow offered a renameserializediscarded — theproperty is written under the key
Valuewhatever the node is called. The row is aclass property bag, so it says so, and
setPropertyasksnameEditablefirst.serialize as
{name, metadata, value}.descriptionEditablejoins thenameEditable/valueEditablefamily and reaches the row, the property inspector andsetProperty.Tests:
test/scCatalog.test.ts(both storage forms, the rename sites, and the sites arename must NOT touch),
test/editsTheFormatCannotKeep.test.ts,test/elementLabelFollowsName.test.ts, plus new fixturesarch_binary.sldd/arch_binary_as_text.slddgenerated bymake-fixtures.mjs. Full suite: 4134 passing.