Skip to content

fix(word): reject tracked changes inside hyperlinks - #548

Closed
rmorgans wants to merge 1 commit into
sergey-tihon:masterfrom
rmorgans:fix/reject-in-hyperlink
Closed

rmorgans wants to merge 1 commit into
sergey-tihon:masterfrom
rmorgans:fix/reject-in-hyperlink

Conversation

@rmorgans

@rmorgans rmorgans commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RevisionProcessor.RejectRevisions keeps the inserted text and drops the deleted text when the revisions sit inside a w:hyperlink, the opposite of Reject All. Accept is correct.

Reproduction

<w:p><w:hyperlink w:anchor="x">
  <w:r><w:t xml:space="preserve">Alpha </w:t></w:r>
  <w:del ...><w:r><w:delText>beta</w:delText></w:r></w:del>
  <w:ins ...><w:r><w:t>delta</w:t></w:r></w:ins>
  <w:r><w:t xml:space="preserve"> gamma</w:t></w:r>
</w:hyperlink></w:p>

Reject gives Alpha delta gamma; Word gives Alpha beta gamma.

Cause. Reject inverts w:del/w:ins and then accepts. ReverseRevisionsTransform only inverts revisions whose nearest ancestor (skipping sdt, sdtContent, smartTag) is w:p, so inside a hyperlink nothing is inverted.

Fix. Skip w:hyperlink as well, like smartTag.

Test. RP053_RevisionsInsideHyperlink (accept and reject).


Found while using RevisionProcessor to 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 current master and passes with the fix; ./build.sh passes.

This is one of six small, independent RevisionProcessor fixes (#548, #549, #550, #551, #552, #553). Each adds its test after RP001 in RevisionProcessorTests.cs, so whichever merges second will need a trivial rebase there; I'll rebase the rest as they land.

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

RevisionProcessor.RejectRevisions inverts w:del/w:ins only when their
nearest ancestor (skipping sdt and smartTag) is a w:p. Inside a
w:hyperlink the revisions were left as they were, so the accept pass
that follows dropped the deleted text and kept the inserted text: the
opposite of Word's Reject All. Treat w:hyperlink as a transparent run
container like w:sdt and w:smartTag.
@rmorgans

Copy link
Copy Markdown
Contributor Author

Folded into #554. All three fixes added a name to the same ancestor predicate in ReverseRevisionsTransform, so they could only merge one at a time with a rebase after each. #554 now covers w:hyperlink, w:fldSimple, w:dir and w:bdo in one change, with one parameterized test. Closing this one to save you the extra rebase cycle.

@rmorgans rmorgans closed this Oct 17, 2026
@rmorgans
rmorgans deleted the fix/reject-in-hyperlink branch October 18, 2026 00:25
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.

1 participant