From 61a372c4ee1c9f1d34f42a31ae6300368663afe7 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 1 Mar 2010 13:03:03 -0800 Subject: Use a tooltip to explain whitespace errors Sometime users are confused about why Gerrit shows a particular part of the new file (which is always green) in red. Its a whitespace error, a case that isn't normal. Explain it with a tooltip message. Change-Id: Ide90f14c4a25eac5a2bcb1bc9f5e6d67e9ac4cb7 Signed-off-by: Shawn O. Pearce --- .../java/com/google/gerrit/prettify/common/PrettyFormatter.java | 8 ++++++-- .../main/resources/com/google/gerrit/prettify/client/gerrit.css | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'gerrit-prettify') 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 e862e66422..c5a8b2763d 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 @@ -441,14 +441,18 @@ public abstract class PrettyFormatter implements SparseHtmlFile { private SafeHtml showTabAfterSpace(SafeHtml src) { final String m = "( ( |]*>|)*\t)"; - final String r = "$1"; + final String r = "$1"; src = src.replaceFirst("^" + m, r); src = src.replaceAll("\n" + m, "\n" + r); return src; } private SafeHtml showTrailingWhitespace(SafeHtml src) { - final String r = "$1$2"; + final String r = "$1$2"; src = src.replaceAll("([ \t][ \t]*)(\r?()?\n)", r); src = src.replaceFirst("([ \t][ \t]*)(\r?()?\n?)$", r); return src; diff --git a/gerrit-prettify/src/main/resources/com/google/gerrit/prettify/client/gerrit.css b/gerrit-prettify/src/main/resources/com/google/gerrit/prettify/client/gerrit.css index 86f53d69ed..85276ae179 100644 --- a/gerrit-prettify/src/main/resources/com/google/gerrit/prettify/client/gerrit.css +++ b/gerrit-prettify/src/main/resources/com/google/gerrit/prettify/client/gerrit.css @@ -21,6 +21,7 @@ .wse { background: red; + cursor: pointer; } .vt { -- cgit v1.2.3