diff options
author | James Moger <james.moger@gitblit.com> | 2015-03-07 11:26:23 -0600 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2015-03-07 11:26:23 -0600 |
commit | 62ff847f820fc69c308aeff4b317963cd4eadce0 (patch) | |
tree | 163f481fa095a5611665f65befae6227cf83c8e1 /src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java | |
parent | fd1cb098408a418c2c102cb5585a4b61ea216e1a (diff) | |
parent | 520a470b22ea53bd8b418aaac498a8672e2c0779 (diff) | |
download | gitblit-62ff847f820fc69c308aeff4b317963cd4eadce0.tar.gz gitblit-62ff847f820fc69c308aeff4b317963cd4eadce0.zip |
Merged #233 "Ignore whitespace in diff viewer"
Diffstat (limited to 'src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java')
-rw-r--r-- | src/main/java/com/gitblit/utils/GitBlitDiffFormatter.java | 8 |
1 files changed, 5 insertions, 3 deletions
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("<span class='trailingws-").append(prefix == '+' ? "add" : "sub").append("'>"); result.append(StringUtils.escapeForHtml(matcher.group(1), false)); result.append("</span>"); 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("<th class='diff-state diff-state-sub'></th><td class=\"diff-cell remove2\">"); } - line = StringUtils.escapeForHtml(line.substring(1), false); + line = StringUtils.escapeForHtml(line.substring(1), CONVERT_TABS); } sb.append(line); if (gitLinkDiff) { |