You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [item 1] Add verticalLines/horizontalLines fields to MTMathTable
Adds inert NSArray<NSNumber*>* verticalLines/horizontalLines properties to
MTMathTable, defaulting to empty arrays and deep-copied in -copyWithZone:.
No behavior change for existing environments (fields are unused until the
array environment factory constructor consumes them).
* [item 2] Add +arrayTableWithAlignments factory constructor
Adds MTMathAtomFactory +arrayTableWithAlignments:verticalLines:horizontalLines:rows:error:,
which builds a bare textstyle MTMathTable for the array environment from
already-validated structured input (alignments/vertical-line counts computed
by the future column-spec parser). horizontalLines is normalized to
numRows+1 entries so the renderer can index every row boundary.
* [item 3] Validate array row cell counts (too-many-cells / short-row)
Pins the too-many-cells and short-row contract of
+arrayTableWithAlignments:verticalLines:horizontalLines:rows:error: with
explicit tests. The validation guard itself was already introduced in
item 2; no production code changes here.
* Declare verticalLines/horizontalLines copy for snapshot safety
The new NSArray properties were strong (default), so the setter aliased
the caller's array by reference. The factory itself assigns a mutable
hLines behind the NSArray*-typed horizontalLines, so a later in-place
mutation would leak into the stored table. Declare both properties copy
(the standard Cocoa idiom for an immutable-snapshot NSArray, O(1) when
the source is already immutable). With the copy setters, copyWithZone:
no longer needs arrayWithArray: — a plain assignment snapshots.
Adds a test that mutating a mutable array after assignment does not
change the stored value.
* Pad short array rows to numCols; normalize verticalLines (review)
Address gemini review on #251:
- Pad short rows out to numCols so a trailing all-empty column keeps its
alignment and vertical rule (numColumns is derived from the widest row).
- Normalize verticalLines to numCols+1 (mirrors horizontalLines) and guard
nil for both nonnull line params.
Not adopted: the reviewer's out-of-bounds crash framing and the truncation
of over-long line arrays. -columnOffsetsForTable: already bounds-guards every
access (i < vLines.count ? ... : 0) and the rule loops iterate the arrays'
own counts, so a short/over-long array cannot crash; truncating would also
silently swallow caller mistakes.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments