Disable syntax highlighting on unified views
Because we can't use background colors to denote added or removed lines in the unified patch view, turn off syntax highlighting so we can color the text of added lines green and deleted lines red. Bug: issue 448 Change-Id: I994758b93e4f8b5633cd61c13911280c0bd7aafa Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
6f7f748231
commit
45442f8782
@ -88,6 +88,7 @@ public abstract class PatchScreen extends Screen {
|
||||
public Unified(final Patch.Key id, final int patchIndex,
|
||||
final PatchTable patchTable) {
|
||||
super(id, patchIndex, patchTable);
|
||||
scriptSettings.getPrettySettings().setSyntaxHighlighting(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +114,13 @@ public abstract class PrettyFormatter {
|
||||
settings = how;
|
||||
lines = new ArrayList<String>();
|
||||
|
||||
String html = prettify(toHTML(srcText));
|
||||
String html = toHTML(srcText);
|
||||
if (settings.isSyntaxHighlighting()) {
|
||||
html = prettify(html);
|
||||
} else {
|
||||
html = html.replaceAll("\n", "<br />");
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
int textChunkStart = 0;
|
||||
|
||||
|
@ -21,12 +21,14 @@ public class PrettySettings {
|
||||
protected int lineLength;
|
||||
protected int tabSize;
|
||||
protected boolean showTabs;
|
||||
protected boolean syntaxHighlighting;
|
||||
|
||||
public PrettySettings() {
|
||||
showWhiteSpaceErrors = true;
|
||||
lineLength = 100;
|
||||
tabSize = 2;
|
||||
showTabs = true;
|
||||
syntaxHighlighting = true;
|
||||
}
|
||||
|
||||
public PrettySettings(PrettySettings pretty) {
|
||||
@ -35,6 +37,7 @@ public class PrettySettings {
|
||||
lineLength = pretty.lineLength;
|
||||
tabSize = pretty.tabSize;
|
||||
showTabs = pretty.showTabs;
|
||||
syntaxHighlighting = pretty.syntaxHighlighting;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
@ -81,4 +84,12 @@ public class PrettySettings {
|
||||
showTabs = show;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSyntaxHighlighting() {
|
||||
return syntaxHighlighting;
|
||||
}
|
||||
|
||||
public void setSyntaxHighlighting(final boolean on) {
|
||||
syntaxHighlighting = on;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user