summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-04-11 16:37:50 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-04-11 17:24:06 -0400
commit9c47249d13326de86b910d0dcc10410210585e1e (patch)
tree127527712cf79e6bab575a8cb54cca1f6522c323
parent704a259562349be0fa1a17d493754db00a97dc15 (diff)
downloadpython-coveragepy-git-9c47249d13326de86b910d0dcc10410210585e1e.tar.gz
fix: restore html report selection highlighting
-rw-r--r--CHANGES.rst4
-rw-r--r--coverage/htmlfiles/coverage_html.js9
2 files changed, 6 insertions, 7 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 57192db2..63b0125f 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -34,6 +34,10 @@ Unreleased
- Coverage will no longer generate "Already imported a file that will be
measured" warnings about coverage itself (`issue 905`_).
+- The HTML report uses j/k to move up and down among the highlighted chunks of
+ code. They used to highlight the current chunk, but 5.0 broke that behavior.
+ Now the highlighting is working again.
+
- The JSON report now includes ``percent_covered_display``, a string with the
total percentage, rounded to the same number of decimal places as the other
reports' totals.
diff --git a/coverage/htmlfiles/coverage_html.js b/coverage/htmlfiles/coverage_html.js
index 27b49b36..c2151d34 100644
--- a/coverage/htmlfiles/coverage_html.js
+++ b/coverage/htmlfiles/coverage_html.js
@@ -311,11 +311,6 @@ coverage.line_elt = function (n) {
return $("#t" + n);
};
-// Return the nth line number div.
-coverage.num_elt = function (n) {
- return $("#n" + n);
-};
-
// Set the selection. b and e are line numbers.
coverage.set_sel = function (b, e) {
// The first line selected.
@@ -514,9 +509,9 @@ coverage.show_selection = function () {
var c = coverage;
// Highlight the lines in the chunk
- $(".linenos .highlight").removeClass("highlight");
+ $("#source .highlight").removeClass("highlight");
for (var probe = c.sel_begin; probe > 0 && probe < c.sel_end; probe++) {
- c.num_elt(probe).addClass("highlight");
+ c.line_elt(probe).addClass("highlight");
}
c.scroll_to_selection();