From: James Moger Date: Thu, 26 Feb 2015 17:37:11 +0000 (-0500) Subject: Restore tab conversion to 4 spaces in HTML diff output X-Git-Tag: v1.7.0~1^2~78^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8621be4f655ea222dd1f0063c8e65085f0b78caa;p=gitblit.git Restore tab conversion to 4 spaces in HTML diff output --- diff --git a/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java b/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java index 3c65267b..8f0d223a 100644 --- a/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java +++ b/src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java @@ -74,6 +74,8 @@ public class GitBlitDiffFormatter extends DiffFormatter { */ private static final int GLOBAL_DIFF_LIMIT = 20000; + private static final boolean CONVERT_TABS = true; + private final DiffOutputStream os; private final DiffStat diffStat; @@ -451,14 +453,14 @@ public class GitBlitDiffFormatter extends DiffFormatter { // Highlight trailing whitespace on deleted/added lines. Matcher matcher = trailingWhitespace.matcher(line); if (matcher.find()) { - StringBuilder result = new StringBuilder(StringUtils.escapeForHtml(line.substring(0, matcher.start()), false)); + StringBuilder result = new StringBuilder(StringUtils.escapeForHtml(line.substring(0, matcher.start()), CONVERT_TABS)); result.append(""); result.append(StringUtils.escapeForHtml(matcher.group(1), false)); result.append(""); return result.toString(); } } - return StringUtils.escapeForHtml(line, false); + return StringUtils.escapeForHtml(line, CONVERT_TABS); } /** @@ -490,7 +492,7 @@ public class GitBlitDiffFormatter extends DiffFormatter { } else { sb.append(""); } - line = StringUtils.escapeForHtml(line.substring(1), false); + line = StringUtils.escapeForHtml(line.substring(1), CONVERT_TABS); } sb.append(line); if (gitLinkDiff) {