Merge "PrettyFormatter: Fix expand tab when syntax coloring is on." into stable-2.6

This commit is contained in:
Shawn Pearce 2013-07-06 01:35:19 +00:00 committed by Gerrit Code Review
commit 6ad00aa21b
2 changed files with 3 additions and 5 deletions

View File

@ -62,13 +62,12 @@ public class ClientSideFormatter extends PrettyFormatter {
@Override @Override
protected String prettify(String html, String type) { 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, 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); return ctx.prettyPrintOne(srcText, srcType);
}-*/; }-*/;
} }

View File

@ -128,6 +128,7 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
String html = toHTML(src); String html = toHTML(src);
html = expandTabs(html);
if (diffPrefs.isSyntaxHighlighting() && getFileType() != null if (diffPrefs.isSyntaxHighlighting() && getFileType() != null
&& src.isWholeFile()) { && src.isWholeFile()) {
// The prettify parsers don't like ' as an entity for the // The prettify parsers don't like ' as an entity for the
@ -148,8 +149,6 @@ public abstract class PrettyFormatter implements SparseHtmlFile {
html = html.replaceAll("(\r)?\n", " $1\n"); html = html.replaceAll("(\r)?\n", " $1\n");
html = prettify(html, getFileType()); html = prettify(html, getFileType());
html = html.replaceAll(" (\r)?\n", "$1\n"); html = html.replaceAll(" (\r)?\n", "$1\n");
} else {
html = expandTabs(html);
} }
int pos = 0; int pos = 0;