Repository navigation
fix(word): widen the cell before a rejected inserted cell - #556
Merged
Merged
Conversation
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.
This was referenced Oct 17, 2026
Contributor
There was a problem hiding this comment.
🟡 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


RevisionProcessor.RejectRevisionsremoves a cell markedw:cellInsand 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 aw:cellDel(AcceptDeletedCellsTransform, fixed further in #555).Reproduction. A 2×2 table where cell B2 is marked
w:cellIns.A1 | B1 / A2, with row 2 one grid column short.A1 | B1 / A2 (gridSpan 2).Fix. When rejecting, turn
w:cellInsintow: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 aw: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 fileRevisionProcessorTests.CellIns.cs. AllRP001baselines still pass, includingRP034/RP035.Relation to #553. Copilot's open comment on #553 about
RevisionProcessor.cs:31says that rejecting an inserted cell removes it before the comment paragraph IDs are captured. I ran a throwaway test: a comment whose final paragraphw14:paraId="22222222"is in aw:cellInscell, then Reject All, checking the ID on the comment's last paragraph.w:tcPrChangeWith this PR, the cell is removed in the accept pass, after #553 captures the IDs, so the common case is covered. The
w:tcPrChangecase 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.csto make the classpartial, 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.