Repository navigation
fix(word): remove the paragraph whose mark was moved away - #552
Merged
sergey-tihon merged 1 commit intoOct 18, 2026
Merged
Conversation
This was referenced Oct 15, 2026
AcceptMoveFromMoveToTransform removed every w:moveFrom, including the marker of a moved-from paragraph mark (w:pPr/w:rPr/w:moveFrom), before AcceptDeletedAndMoveFromParagraphMarks could join that paragraph with the next. Accept All therefore left an empty paragraph where a moved paragraph had been, and Reject All (which swaps moveFrom and moveTo, then accepts) left one where it had gone. Word leaves neither. Keep a moved-from paragraph mark as a deleted one so the existing deleted-paragraph-mark handling applies. The RP015 baselines recorded the empty paragraph; drop it from both (RP018, the same move inside a content control, already expected none). The test lives in its own partial-class file so that concurrent RevisionProcessor fixes do not edit the same lines.
rmorgans
force-pushed
the
fix/moved-paragraph-mark
branch
from
October 17, 2026 23:18
ec48c70 to
5934b9e
Compare
This was referenced Oct 17, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow fix reuses existing paragraph-joining logic and covers both operations with regression tests, with no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes Word revision processing so accepting or rejecting a moved paragraph does not leave an empty paragraph behind.
Changes:
- Routes moved-from paragraph marks through existing deleted-mark handling.
- Adds regression coverage for both acceptance and rejection.
- Makes the test class partial to support the separate regression file.
| File | Description |
|---|---|
| Clippit/Word/RevisionProcessor.cs | Preserves moved-from paragraph marks for paragraph joining. |
| Clippit.Tests/Word/RevisionProcessorTests.MovedParagraphMark.cs | Tests paragraph order and revision cleanup for both operations. |
| Clippit.Tests/Word/RevisionProcessorTests.cs | Makes the test class partial. |
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.
When a whole paragraph is moved with tracking (
w:moveFrom/w:moveTo, including the paragraph mark inw:pPr/w:rPr), both Accept and Reject leave an empty paragraph behind.Reproduction. Paragraphs
Before | Moved (moveFrom, mark moved) | Middle | Moved (moveTo, mark moved) | After.Before | (empty) | Middle | Moved | After; Word givesBefore | Middle | Moved | After.Before | Moved | Middle | (empty) | After; Word givesBefore | Moved | Middle | After.Cause.
AcceptMoveFromMoveToTransformremoves everyw:moveFrom, including the paragraph-mark marker, beforeAcceptDeletedAndMoveFromParagraphMarkscan join that paragraph with the next.Fix. Treat a moved-from paragraph mark as a deleted paragraph mark so the existing handling joins it.
Baselines.
RP015-MoveFrom-MoveTo-Accepted.docxand-Rejected.docxcontained the empty paragraph; I removed only that paragraph from each (everything else unchanged). TheRP018baselines (the same move inside a content control) already expected no empty paragraph.Test.
RP056_MovedParagraphLeavesNoEmptyParagraph.Found while using
RevisionProcessorto check that Reject All of a tracked-change redline gives back the original document. Expected results are Microsoft Word for Mac 16.113's own Accept All / Reject All on the same markup. The regression test fails on master and passes with the fix.Merging. Rebased on master after #550, #551 and #555 landed. The test is now in the new file
RevisionProcessorTests.MovedParagraphMark.cs. The only edit toRevisionProcessorTests.csmakes the classpartial, the same one-word edit as in #554 and #556, so this PR, those two and #553 merge cleanly in any order. I checked this by merging all four onto master: no conflicts, and the full suite passes.Prepared with an AI coding agent (Claude); I reviewed the change and ran the tests.