Page MenuHomePhabricator

Correct a prose diff behavior when prose pieces include newlines
ClosedPublic

Authored by epriestley on May 30 2020, 9:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 5:16 PM
Unknown Object (File)
Fri, Apr 19, 1:09 PM
Unknown Object (File)
Fri, Apr 19, 11:19 AM
Unknown Object (File)
Thu, Apr 18, 6:06 AM
Unknown Object (File)
Tue, Apr 16, 10:51 AM
Unknown Object (File)
Thu, Apr 11, 9:02 AM
Unknown Object (File)
Mon, Apr 1, 5:19 PM
Unknown Object (File)
Sat, Mar 30, 9:26 AM
Subscribers

Details

Summary

See https://discourse.phabricator-community.org/t/bad-regex-in-prose-diff-logic/3969.

The prose splitting rules normally guarantee that newlines appear only at the beginning or end of blocks. However, if a prose sentence ends with text like "...x\n.", we can end up with a newline inside a "sentence".

If we do, the regular expression that breaks it into pieces will fail.

Arguably, this is an error in how sentences are split apart (we might prefer to split this into two sentences, "x\n" and ".", rather than a single "x\n." sentence) but in the general case it's not unreasonable for blocks to contain newlines, so a simple fix is to make the pattern more robust.

Test Plan

Added a failing test which includes this behavior, made it pass.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.May 30 2020, 9:11 PM
This revision was automatically updated to reflect the committed changes.

thanks. I can confirm the change lets the daemon finish the task and renders a reasonable diff.