diff --git a/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php b/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php --- a/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php +++ b/src/infrastructure/diff/prose/PhutilProseDifferenceEngine.php @@ -148,7 +148,7 @@ // whitespace at the end. $matches = null; - preg_match('/^(\s*)(.*?)(\s*)\z/', $result, $matches); + preg_match('/^(\s*)(.*?)(\s*)\z/s', $result, $matches); if (strlen($matches[1])) { $results[] = $matches[1]; diff --git a/src/infrastructure/diff/prose/__tests__/PhutilProseDiffTestCase.php b/src/infrastructure/diff/prose/__tests__/PhutilProseDiffTestCase.php --- a/src/infrastructure/diff/prose/__tests__/PhutilProseDiffTestCase.php +++ b/src/infrastructure/diff/prose/__tests__/PhutilProseDiffTestCase.php @@ -30,6 +30,14 @@ ), pht('Remove Paragraph')); + $this->assertProseParts( + 'xxx', + "xxxyyy\n.zzz", + array( + '= xxx', + "+ yyy\n.zzz", + ), + pht('Amend paragraph, and add paragraph starting with punctuation')); // Without smoothing, the alogorithm identifies that "shark" and "cat" // both contain the letter "a" and tries to express this as a very