HomePhabricator

Correct a prose diff behavior when prose pieces include newlines

Description

Correct a prose diff behavior when prose pieces include newlines

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.

Differential Revision: https://secure.phabricator.com/D21295

Details

Provenance
epriestleyAuthored on May 30 2020, 8:31 PM
epriestleyPushed on May 30 2020, 9:11 PM
Differential Revision
D21295: Correct a prose diff behavior when prose pieces include newlines
Parents
rPf686a0b8275e: In Phortune accounts, prevent self-removal more narrowly
Branches
Unknown
Tags
Unknown
Build Status
Buildable 24533
Build 33808: Run Core Tests