File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed
Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 3535 :group 'python-coverage
3636 :type 'string )
3737
38+ (defcustom python-coverage-overlay-width nil
39+ " Maximum width of the overlays.
40+
41+ If nil, highlight the whole statement. If a number, highlight up
42+ to that number of characters, or until the end of line, whichever
43+ comes first. Practically, a small number such as 2 will result in
44+ non-obtrusive colored blocks adjacent to the left margin."
45+ :group 'python-coverage
46+ :type '(choice integer (const :tag " Complete line" nil )))
47+
3848(defface python-coverage-overlay-missing
3949 '((t :inherit magit-diff-removed))
4050 " Overlay face for missing coverage."
@@ -313,10 +323,19 @@ If OUTDATED is non-nil, use a different style."
313323 (point )))
314324 (end
315325 (save-excursion
316- (widen )
317326 (goto-char beg)
318- (python-nav-end-of-statement )
319- (1+ (point ))))
327+ (if python-coverage-overlay-width
328+ (min
329+ (line-end-position )
330+ (progn
331+ (forward-char python-coverage-overlay-width)
332+ (point )))
333+ (python-nav-end-of-statement )
334+ (1+ (point )))))
335+ (end
336+ ; ; At least one character. This should only happen for
337+ ; ; outdated overlays on empty lines.
338+ (max end (1+ beg)))
320339 (face
321340 (pcase status
322341 ('missing
You can’t perform that action at this time.
0 commit comments