Skip to content

fix(word): widen the cell before a rejected inserted cell - #556

Merged
sergey-tihon merged 4 commits into
sergey-tihon:masterfrom
rmorgans:fix/reject-cellins
Oct 18, 2026
Merged

sergey-tihon merged 4 commits into
sergey-tihon:masterfrom
rmorgans:fix/reject-cellins

Conversation

@rmorgans

Copy link
Copy Markdown
Contributor

RevisionProcessor.RejectRevisions removes a cell marked w:cellIns and leaves its row one cell short. Word's Reject All gives the inserted cell's columns to the cell before it. Clippit already does the same thing when it accepts a w:cellDel (AcceptDeletedCellsTransform, fixed further in #555).

Reproduction. A 2×2 table where cell B2 is marked w:cellIns.

  • Reject gives A1 | B1 / A2, with row 2 one grid column short.
  • Word gives A1 | B1 / A2 (gridSpan 2).

Fix. When rejecting, turn w:cellIns into w:cellDel. The accept pass then removes the cell and widens the one before it. There is one exception, and it matches what Word does. If the cell before has a w:tcPrChange, as when a cell was split (RP035), Word restores the recorded properties and does not widen the cell, so the inserted cell is only removed, as before.

Test. RP061_RejectedInsertedCellWidensCellBefore (accept and reject) is in the new file RevisionProcessorTests.CellIns.cs. All RP001 baselines still pass, including RP034/RP035.

Relation to #553. Copilot's open comment on #553 about RevisionProcessor.cs:31 says that rejecting an inserted cell removes it before the comment paragraph IDs are captured. I ran a throwaway test: a comment whose final paragraph w14:paraId="22222222" is in a w:cellIns cell, then Reject All, checking the ID on the comment's last paragraph.

Branch Plain inserted cell Cell before has w:tcPrChange
#553 alone ID lost ID lost
#553 + this PR ✅ kept ID lost

With this PR, the cell is removed in the accept pass, after #553 captures the IDs, so the common case is covered. The w:tcPrChange case still removes the cell during the reject pass. Capturing the IDs before rejection, as Copilot suggests, would cover both.

Merging. Like #552 and #554, this one only edits RevisionProcessorTests.cs to make the class partial, the same one-word edit as those PRs. The four PRs merge onto master together without conflicts, and the full suite passes.


Expected results are Microsoft Word for Mac 16.113's own Accept All / Reject All on the same markup. The regression test fails on current master and passes with the fix.

Prepared with an AI coding agent (Claude). I reviewed the change and ran the tests.

RevisionProcessor.RejectRevisions removed a cell marked w:cellIns and
left its row a cell short. Word's Reject All gives the inserted cell's
columns to the cell before it (gridSpan 2 for one inserted cell), as
Clippit already does when accepting a w:cellDel. Reject an inserted
cell as a deleted one, so AcceptDeletedCellsTransform removes it and
widens the cell before.

Where the cell before carries a w:tcPrChange, as when a cell was split
(RP035), Word does not widen it and its recorded properties are
restored, so the inserted cell is only removed, as before.

The test lives in its own partial-class file so that concurrent
RevisionProcessor fixes do not edit the same lines.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved cases can delete unrelated nested-table content, retain rejected inserted cells, or transfer too few columns.

3 open issues
What changed in this PR

Updates Word revision rejection to give rejected inserted cells’ columns to the preceding cell through the existing deletion-handling pass.

Changes:

  • Converts inserted-cell markers to deletion markers, preserving the preceding-cell property-change exception.
  • Adds accept/reject regression coverage in a separate partial test file.
  • Updates the rejection behavior documentation.
File Description
Clippit/​Word/​RevisionProcessor.cs Changes inserted-cell rejection and documents the handoff.
Clippit.Tests/​Word/​RevisionProcessorTests.cs Makes the test class partial.
Clippit.Tests/​Word/​RevisionProcessorTests.CellIns.cs Adds inserted-cell accept/reject coverage.

Review effort: Balanced

Comment thread Clippit/Word/RevisionProcessor.cs
Comment thread Clippit/Word/RevisionProcessor.cs
Comment thread Clippit/Word/RevisionProcessor.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Wrapped inserted cells can survive rejection with their content and tracked deletion markers intact.

1 open issue
3 resolved since last review

Review effort: Balanced

Comment thread Clippit/Word/RevisionProcessor.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues were identified, and regression tests cover the changed behavior; tests were not executed during review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@sergey-tihon
sergey-tihon merged commit 1ad1b83 into sergey-tihon:master Oct 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants