Fix NSTableView batch update 1234 -> 3412 #69
Closed
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.
I had an issue where NSTableView wouldn't execute the moves correctly for the scenario
0123
→2301
I realized that the moves produced by extendedDiff were
[M(0,2), M(1,3)]
Applying them in order would mean:
0123
+M(0,2)
→1203
1203
+M(1,3)
→1032
This (
1032
) is also what NSTableView showed after applying the extended diff, but not what we wanted to achieve in the first placeApplying it in reversed order means
0123
+M(1,3)
→0231
0231
+M(0,2)
→2301
which is what we wantedSo reversing the moves fixes this problem for NSTableView.
UITableView seems to not have these problems, I think it sorts the moves by itself somehow.
Unfortunately the related test
0123
->3120
, resulting in[M(3,0), M(0,3)]
(or reversed depending on this PR)is not animated by NSTableView at all. I think this is because it applies them in sequence and the two moves basically cancel each other out.
Is there something else we could use for NSTableView which would work sequentially?
Again, UITableView seems to not have these problems.