summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2013-07-06 01:35:19 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-07-06 01:35:19 +0000
commit6ad00aa21bcf16caddd3398dfc5cdfb13f8ea781 (patch)
treeb17c5eda9c731181cb0688ed5000b48cc69f7f47
parentd87337d8f9f8dcdb0a416b7cdc94c927b36b0e0e (diff)
parenta7417cf75d68689ea0bc275f0062fc90d7a5afd1 (diff)
Merge "PrettyFormatter: Fix expand tab when syntax coloring is on." into stable-2.6
-rw-r--r--gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java5
-rw-r--r--gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java3
2 files changed, 3 insertions, 5 deletions
diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java
index 1436bba860..8d5ddb9000 100644
--- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java
+++ b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/client/ClientSideFormatter.java
@@ -62,13 +62,12 @@ public class ClientSideFormatter extends PrettyFormatter {
@Override
protected String prettify(String html, String type) {
- return go(prettify.getContext(), html, type, diffPrefs.getTabSize());
+ return go(prettify.getContext(), html, type);
}
private static native String go(JavaScriptObject ctx, String srcText,
- String srcType, int tabSize)
+ String srcType)
/*-{
- ctx.PR_TAB_WIDTH = tabSize;
return ctx.prettyPrintOne(srcText, srcType);
}-*/;
}
diff --git a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java
index d07a34da79..5786e9587a 100644
--- a/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java
+++ b/gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java
@@ -128,6 +128,7 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
String html = toHTML(src);
+ html = expandTabs(html);
if (diffPrefs.isSyntaxHighlighting() && getFileType() != null
&& src.isWholeFile()) {
// The prettify parsers don't like &#39; as an entity for the
@@ -148,8 +149,6 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
html = html.replaceAll("(\r)?\n", " $1\n");
html = prettify(html, getFileType());
html = html.replaceAll(" (\r)?\n", "$1\n");
- } else {
- html = expandTabs(html);
}
int pos = 0;