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>
This commit is contained in:
Shawn O. Pearce
2010-03-01 13:03:03 -08:00
parent c6c848690a
commit 61a372c4ee
2 changed files with 7 additions and 2 deletions

View File

@@ -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;

View File

@@ -21,6 +21,7 @@
.wse {
background: red;
cursor: pointer;
}
.vt {