Page MenuHomePhabricator

Correct a prose diff behavior when prose pieces include newlines

Authored by epriestley on May 30 2020, 9:04 PM.




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

rP Phabricator
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; 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.