bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27281: Fix nlinum missing line numbers.


From: William Gilbert
Subject: bug#27281: Fix nlinum missing line numbers.
Date: Wed, 7 Jun 2017 17:46:29 -0400

I've been working to track to down a bug where line numbers are occasionally missing when using nlinum mode. Currently there is a package written to workaround the problem that has a picture and description of the problem: https://github.com/hlissner/emacs-nlinum-hl.

After extensive debugging I've tracked the problem down to the 'nlinum--region' function. Specifically the while loop check that determines if '(point)' is less than the limit. I've found that the problem exists when '(point)' is exactly equal to 'limit'. In this scenario the loop terminates and the last line in the region is not provided with a line number. I was able to remedy the problem by changing the condition from 'less than' to 'less than or equal to', which will allow the last line in the region to be properly assigned a line number.

Thank you.

Diff:

diff --git a/packages/nlinum/nlinum.el b/packages/nlinum/nlinum.el
index ca4f949fc..f82b61987 100644
--- a/packages/nlinum/nlinum.el
+++ b/packages/nlinum/nlinum.el
@@ -303,7 +303,7 @@ it may cause the margin to be resized and line numbers to be recomputed.")
       (remove-overlays (point) limit 'nlinum t)
       (let ((line (nlinum--line-number-at-pos)))
         (while
-            (and (not (eobp)) (< (point) limit)
+            (and (not (eobp)) (<= (point) limit)
                  (let* ((ol (make-overlay (point) (1+ (point))))
                         (str (funcall nlinum-format-function
                                       line nlinum--width))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]