Because tables are matrices and not really trees, the tree differ can show odd results for more complex operations, for example cell 'A' merged with 'E' below:
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Daff table diffing | VisualEditor/VisualEditor | master | +11 K -97 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | None | T211897 Visual Diffs: Improve table diffing | |||
Open | None | T149851 Handle visual diffing of table cell merges |
Event Timeline
In general though this problem seems like potentially a lot of work for an uncommon edge case.
Another example is a row/col deletion that results a colspan/rowspan change:
Here 7,8,10 is deleted which makes 9 shorter:
The output is still more legible than wikitext though.
We also need to decide how we'd like table (un)merges to appear.
Unmergres can simple be shown as the insertion of all but the top left cell:
->Going the other way is a little more complex, to be discussed?
Agree on un-merges. Not sure what you're showing in "the other way" – is that adding things to an already merged cell?
It shows merging 4 cells (in red) into 1 cell (green). The easier solution is just to not show the removed content.
Change 455321 had a related patch set uploaded (by Esanders; author: Tchanders):
[VisualEditor/VisualEditor@master] Daff table diffing
Before patch | After patch | Comments | |
A+E merge | Layout less broken visually, but the removed content is not shown | ||
Merge | As above | ||
Unmerge | Almost no change | ||
Row removal | Both quite broken. Displaying removed cells will always cause problems when colspan/rowspan is involved | ||
I think not showing the remove content in cell merges is better than breaking the layout, and we can iterate towards the design shown above: