diff options
author | Shawn O. Pearce <sop@google.com> | 2010-03-01 13:03:03 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-03-01 13:03:03 -0800 |
commit | 61a372c4ee1c9f1d34f42a31ae6300368663afe7 (patch) | |
tree | 0719bb4b2372f21744abb97d519b356f83b9dab9 | |
parent | c6c848690a19cd96da5dc238e329618886592bf0 (diff) |
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 <sop@google.com>
-rw-r--r-- | gerrit-prettify/src/main/java/com/google/gerrit/prettify/common/PrettyFormatter.java | 8 | ||||
-rw-r--r-- | gerrit-prettify/src/main/resources/com/google/gerrit/prettify/client/gerrit.css | 1 |
2 files changed, 7 insertions, 2 deletions
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 = "( ( |<span[^>]*>|</span>)*\t)"; - final String r = "<span class=\"wse\">$1</span>"; + final String r = "<span class=\"wse\"" // + + " title=\"" + PrettifyConstants.C.wseTabAfterSpace() + "\"" // + + ">$1</span>"; src = src.replaceFirst("^" + m, r); src = src.replaceAll("\n" + m, "\n" + r); return src; } private SafeHtml showTrailingWhitespace(SafeHtml src) { - final String r = "<span class=\"wse\">$1</span>$2"; + final String r = "<span class=\"wse\"" // + + " title=\"" + PrettifyConstants.C.wseTrailingSpace() + "\"" // + + ">$1</span>$2"; src = src.replaceAll("([ \t][ \t]*)(\r?(</span>)?\n)", r); src = src.replaceFirst("([ \t][ \t]*)(\r?(</span>)?\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 { |