Fix ArrayIndexOutOfBoundsException on intraline diff again

When using intraline diffs with show line endings, a user could
encounter an ArrayIndexOutOfBoundsException when going from a file
with just newlines to carriage returns and newlines.  This only
impacts the legacy change screen, however.  Since the newline
may be in a span element itself, it looks like we have some more
things to check.

Change-Id: I65443f487be60a949346398a487de38eb88e75dd
This commit is contained in:
Doug Kelly 2014-02-10 12:43:48 -06:00
parent ea2c0074f2
commit c58489e934

View File

@ -145,7 +145,7 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
// separated by '</span>'. For the prettify parser this now looks like two
// separate line endings. This messes up the line counting below.
// Drop any '\r' to avoid this problem.
html = html.replace("\r</span>\n", "</span>\n");
html = html.replaceAll("\r</span>(<span class=\"wdc\">)?\n", "</span>$1\n");
html = html.replaceAll("(\r)?\n", " $1\n");
html = prettify(html, getFileType());