Work around prettify stripping empty lines

Latest prettify build appears to delete empty lines from the end of
the input file. This causes Gerrit to crash with array exceptions
because the formatted HTML is a different length then the diff
hunks indicate.

Work around the broken prettify by inserting a fake HTML tag before
each LF and removing it after formatting is complete.

Change-Id: I6d82ce322d401743a8de5ab8090b2adc43a909f5
This commit is contained in:
Shawn Pearce
2013-02-04 10:16:08 -08:00
parent 59a1dacf93
commit 7c98dd4775

View File

@@ -145,8 +145,9 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
// Drop any '\r' to avoid this problem.
html = html.replace("\r</span>\n", "</span>\n");
html = html.replace("\n", "<lf>\n");
html = prettify(html, getFileType());
html = html.replace("<lf>\n", "\n");
} else {
html = expandTabs(html);
}