Subject: Re: bug#33732: 27.0.50; line-number-current-line face bug

From: Eli Zaretskii <[email-masked]>
Date: Fri, 14 Dec 2018 10:46:30 +0200

> From: Jonas Westlund <[email-masked]>
> Date: Thu, 13 Dec 2018 22:49:03 +0100
> 
> When using the built-in display-line-number, placing the point at the
> last line of the file/end of buffer will make the rest of
> the display-number area adopt the line-number-current-line
> face. Modifying the face's background thus produces this kind of effect:
> 
> https://i.imgur.com/pO214Wf.png

Thanks, I tried to fix this on the emacs-26 branch with the patch
below.

    Fix display of line numbers in empty lines beyond EOB
    
    * src/xdisp.c (maybe_produce_line_number): When the current
    line is at EOB, use the 'line-number-current-line' face only
    on that single line, but not on the rest of empty lines beyond
    EOB.  (Bug#33732)

diff --git a/src/xdisp.c b/src/xdisp.c
index 808eab7..435ab2c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21185,7 +21185,10 @@ maybe_produce_line_number (struct it *it)
       if (lnum_face_id != current_lnum_face_id
 	  && (EQ (Vdisplay_line_numbers, Qvisual)
 	      ? this_line == 0
-	      : this_line == it->pt_lnum))
+	      : this_line == it->pt_lnum)
+	  /* Avoid displaying the line-number-current-line face on
+	     empty lines beyond EOB.  */
+	  && it->what != IT_EOB)
 	tem_it.face_id = current_lnum_face_id;
       else
 	tem_it.face_id = lnum_face_id;