@@ -17,7 +17,6 @@ struct PendingChanges: Equatable {
1717 private( set) var insertedRowIndices : Set < Int > = [ ]
1818 private( set) var modifiedCells : [ Int : Set < Int > ] = [ : ]
1919 private( set) var insertedRowData : [ Int : [ String ? ] ] = [ : ]
20- private( set) var changedRowIndices : Set < Int > = [ ]
2120
2221 private var changeIndex : [ RowChangeKey : Int ] = [ : ]
2322
@@ -77,7 +76,6 @@ struct PendingChanges: Equatable {
7776 if let insertIdx = changeIndex [ RowChangeKey ( rowIndex: rowIndex, type: . insert) ] {
7877 updateInsertedCell ( at: insertIdx, columnIndex: columnIndex,
7978 columnName: columnName, newValue: newValue)
80- changedRowIndices. insert ( rowIndex)
8179 return true
8280 }
8381
@@ -93,7 +91,6 @@ struct PendingChanges: Equatable {
9391 changeIndex [ updateKey] = changes. count - 1
9492 modifiedCells [ rowIndex, default: [ ] ] . insert ( columnIndex)
9593 }
96- changedRowIndices. insert ( rowIndex)
9794 return true
9895 }
9996
@@ -103,7 +100,6 @@ struct PendingChanges: Equatable {
103100 modifiedCells. removeValue ( forKey: rowIndex)
104101 appendChange ( RowChange ( rowIndex: rowIndex, type: . delete, originalRow: originalRow) )
105102 deletedRowIndices. insert ( rowIndex)
106- changedRowIndices. insert ( rowIndex)
107103 }
108104
109105 mutating func recordRowInsertion( rowIndex: Int , values: [ String ? ] ) {
@@ -114,7 +110,6 @@ struct PendingChanges: Equatable {
114110 insertedRowData [ rowIndex] = values
115111 appendChange ( RowChange ( rowIndex: rowIndex, type: . insert, cellChanges: [ ] ) )
116112 insertedRowIndices. insert ( rowIndex)
117- changedRowIndices. insert ( rowIndex)
118113 }
119114
120115 // MARK: - Mutate (cancelling pending edits)
@@ -123,7 +118,6 @@ struct PendingChanges: Equatable {
123118 guard deletedRowIndices. contains ( rowIndex) else { return false }
124119 removeChange ( rowIndex: rowIndex, type: . delete)
125120 deletedRowIndices. remove ( rowIndex)
126- changedRowIndices. insert ( rowIndex)
127121 return true
128122 }
129123
@@ -135,7 +129,6 @@ struct PendingChanges: Equatable {
135129 insertedRowData. removeValue ( forKey: rowIndex)
136130
137131 shiftRowIndicesDown ( at: rowIndex)
138- changedRowIndices. insert ( rowIndex)
139132 return true
140133 }
141134
@@ -159,7 +152,6 @@ struct PendingChanges: Equatable {
159152 removeChange ( rowIndex: rowIndex, type: . insert)
160153 insertedRowIndices. remove ( rowIndex)
161154 insertedRowData. removeValue ( forKey: rowIndex)
162- changedRowIndices. insert ( rowIndex)
163155 }
164156
165157 let sortedRemoved = validRows. sorted ( )
@@ -188,7 +180,6 @@ struct PendingChanges: Equatable {
188180 modifiedCells. removeValue ( forKey: rowIndex)
189181 appendChange ( RowChange ( rowIndex: rowIndex, type: . delete, originalRow: originalRow) )
190182 deletedRowIndices. insert ( rowIndex)
191- changedRowIndices. insert ( rowIndex)
192183 }
193184
194185 /// Re-apply a cell edit during undo replay (skips undo registration).
@@ -213,7 +204,6 @@ struct PendingChanges: Equatable {
213204 if let insertIdx = changeIndex [ RowChangeKey ( rowIndex: rowIndex, type: . insert) ] {
214205 updateInsertedCell ( at: insertIdx, columnIndex: columnIndex,
215206 columnName: columnName, newValue: newValue)
216- changedRowIndices. insert ( rowIndex)
217207 return
218208 }
219209
@@ -229,7 +219,6 @@ struct PendingChanges: Equatable {
229219 changeIndex [ updateKey] = changes. count - 1
230220 modifiedCells [ rowIndex, default: [ ] ] . insert ( columnIndex)
231221 }
232- changedRowIndices. insert ( rowIndex)
233222 }
234223
235224 /// Replace an inserted row's cell value during undo replay (no shift, no undo).
@@ -241,7 +230,6 @@ struct PendingChanges: Equatable {
241230 ) {
242231 guard let insertIdx = changeIndex [ RowChangeKey ( rowIndex: rowIndex, type: . insert) ] else { return }
243232 updateInsertedCell ( at: insertIdx, columnIndex: columnIndex, columnName: columnName, newValue: newValue)
244- changedRowIndices. insert ( rowIndex)
245233 }
246234
247235 /// Restore a cell's value during undo replay when an existing change matches.
@@ -274,7 +262,6 @@ struct PendingChanges: Equatable {
274262 newValue: previousValue
275263 )
276264 }
277- changedRowIndices. insert ( rowIndex)
278265 }
279266
280267 /// Insert a synthetic .insert RowChange for undo replay (e.g., after redoing a deletion's undo).
@@ -291,7 +278,6 @@ struct PendingChanges: Equatable {
291278 if let savedValues {
292279 insertedRowData [ rowIndex] = savedValues
293280 }
294- changedRowIndices. insert ( rowIndex)
295281 }
296282
297283 /// Insert a batch of rows (for undo replay of a batch deletion's undo).
@@ -314,7 +300,6 @@ struct PendingChanges: Equatable {
314300 changes. append ( RowChange ( rowIndex: rowIndex, type: . insert, cellChanges: cellChanges) )
315301 insertedRowIndices. insert ( rowIndex)
316302 insertedRowData [ rowIndex] = values
317- changedRowIndices. insert ( rowIndex)
318303 }
319304 rebuildChangeIndex ( )
320305 }
@@ -338,23 +323,14 @@ struct PendingChanges: Equatable {
338323 insertedRowIndices. removeAll ( )
339324 modifiedCells. removeAll ( )
340325 insertedRowData. removeAll ( )
341- changedRowIndices. removeAll ( )
342326 }
343327
344- mutating func consumeChangedRowIndices( ) -> Set < Int > {
345- let indices = changedRowIndices
346- changedRowIndices. removeAll ( )
347- return indices
348- }
349-
350- /// Replace internal state from a serialized snapshot.
351328 mutating func restore( from snapshot: TabChangeSnapshot ) {
352329 changes = snapshot. changes
353330 deletedRowIndices = snapshot. deletedRowIndices
354331 insertedRowIndices = snapshot. insertedRowIndices
355332 modifiedCells = snapshot. modifiedCells
356333 insertedRowData = snapshot. insertedRowData
357- changedRowIndices = [ ]
358334 rebuildChangeIndex ( )
359335 }
360336
@@ -471,7 +447,6 @@ struct PendingChanges: Equatable {
471447 if changes [ updateIdx] . cellChanges. isEmpty {
472448 removeChangeAt ( updateIdx)
473449 }
474- changedRowIndices. insert ( rowIndex)
475450 return true
476451 }
477452
@@ -494,7 +469,6 @@ struct PendingChanges: Equatable {
494469 }
495470 modifiedCells = newModifiedCells
496471
497- changedRowIndices = Set ( changedRowIndices. map { $0 >= insertionPoint ? $0 + 1 : $0 } )
498472 rebuildChangeIndex ( )
499473 }
500474
0 commit comments