diff options
-rw-r--r-- | coverage/html.py | 15 | ||||
-rw-r--r-- | coverage/htmlfiles/pyfile.html | 2 | ||||
-rw-r--r-- | coverage/htmlfiles/style.css | 22 |
3 files changed, 29 insertions, 10 deletions
diff --git a/coverage/html.py b/coverage/html.py index 6a2132b7..ce394530 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -96,7 +96,7 @@ class HtmlReporter(Reporter): '__version__': coverage.__version__, } self.source_tmpl = Templite( - data("pyfile.html"), self.template_globals + data("pyfile.html"), self.template_globals, ) self.coverage = cov @@ -204,7 +204,7 @@ class HtmlReporter(Reporter): # Figure out how to mark this line. line_class = [] annotate_html = "" - annotate_title = "" + annotate_long = "" if lineno in analysis.statements: line_class.append("stm") if lineno in analysis.excluded: @@ -226,15 +226,14 @@ class HtmlReporter(Reporter): # 219B is RIGHTWARDS ARROW WITH STROKE. short_fmt = "%s ↛ %s" annotate_html = ", ".join(short_fmt % (lineno, d) for d in shorts) - annotate_html += " [?]" - annotate_title = "Line %d was executed, but never jumped to " % lineno + annotate_long = "Line %d was executed, but never jumped to " % lineno if len(longs) == 1: - annotate_title += longs[0] + annotate_long += longs[0] elif len(longs) == 2: - annotate_title += longs[0] + " or " + longs[1] + annotate_long += longs[0] + " or " + longs[1] else: - annotate_title += ", ".join(longs[:-1]) + ", or " + longs[-1] + annotate_long += ", ".join(longs[:-1]) + ", or " + longs[-1] elif lineno in analysis.statements: line_class.append(c_run) @@ -254,7 +253,7 @@ class HtmlReporter(Reporter): 'number': lineno, 'class': ' '.join(line_class) or "pln", 'annotate': annotate_html, - 'annotate_title': annotate_title, + 'annotate_long': annotate_long, }) # Write the HTML page for this file. diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html index ad7969db..fb8e131e 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -77,7 +77,7 @@ </td> <td class="text"> {% for line in lines %} - <p id="t{{line.number}}" class="{{line.class}}">{% if line.annotate %}<span class="annotate" title="{{line.annotate_title}}">{{line.annotate}}</span>{% endif %}{{line.html}}<span class="strut"> </span></p> + <p id="t{{line.number}}" class="{{line.class}}">{% if line.annotate %}<span class="annotate short">{{line.annotate}}</span><span class="annotate long">{{line.annotate_long}}</span>{% endif %}{{line.html}}<span class="strut"> </span></p> {% endfor %} </td> </tr> diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index 4f43b591..ea261e93 100644 --- a/coverage/htmlfiles/style.css +++ b/coverage/htmlfiles/style.css @@ -160,7 +160,7 @@ h2.stats { .help_panel { position: absolute; - background: #ffc; + background: #ffffcc; padding: .5em; border: 1px solid #883; display: none; @@ -227,6 +227,7 @@ td.text { padding: 0 0 0 .5em; border-left: 2px solid #ffffff; white-space: pre; + position: relative; } .text p.mis { @@ -259,6 +260,25 @@ td.text { .text p.hide_par span.annotate { display: none; } +.text span.annotate.long { + display: none; + } +.text p:hover span.annotate.long { + display: block; + max-width: 50%; + white-space: normal; + float: right; + position: absolute; + top: 1.5em; + right: 0; + width: 30em; + height: auto; + background: #ffffcc; + border: 1px solid #888; + padding: .25em .5em; + z-index: 999; + + } /* Syntax coloring */ .text .com { |