unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 37641@debbugs.gnu.org
Subject: bug#37641: major/minor tick faces bleed into empty lines at the end of buffer
Date: Tue, 8 Oct 2019 06:23:36 +0200	[thread overview]
Message-ID: <CAAeL0SQvcuDRwFDuVK-FwXEeT_JY=Far3qx0uxivF28t7HfgDw@mail.gmail.com> (raw)
In-Reply-To: <CAAeL0SRFM5s+3tVxH_ZKe3rUM2s+HoCMPgRJYN+qnye8urD1kw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2036 bytes --]

As an aside, if it is safe to assume that the faces are not going to change
between digits of the line number, perhaps this change would be a gain.

It moves merging the tick faces outside the lnum_buf loop, and it is done
only for the right line numbers and when not beyond_zv.

diff --git i/src/xdisp.c w/src/xdisp.c
index ad73981c1d..2d79a42270 100644
--- i/src/xdisp.c
+++ w/src/xdisp.c
@@ -22657,6 +22657,21 @@ maybe_produce_line_number (struct it *it)
   int width_limit =
     tem_it.last_visible_x - tem_it.first_visible_x
     - 3 * FRAME_COLUMN_WIDTH (it->f);
+
+  /* Select face for tick line numbers, if needed */
+  int tick_face_id = -1;
+  if (!beyond_zv)
+    {
+      if (display_line_numbers_major_tick > 0
+     && (lnum_to_display % display_line_numbers_major_tick == 0))
+   tick_face_id = merge_faces (it->w, Qline_number_major_tick,
+                   0, DEFAULT_FACE_ID);
+      else if (display_line_numbers_minor_tick > 0
+          && (lnum_to_display % display_line_numbers_minor_tick == 0))
+   tick_face_id = merge_faces (it->w, Qline_number_minor_tick,
+                   0, DEFAULT_FACE_ID);
+    }
+
   /* Produce glyphs for the line number in a scratch glyph_row.  */
   for (const char *p = lnum_buf; *p; p++)
     {
@@ -22671,14 +22686,8 @@ maybe_produce_line_number (struct it *it)
           ? this_line == 0
           : this_line == it->pt_lnum))
    tem_it.face_id = current_lnum_face_id;
-      else if (display_line_numbers_major_tick > 0
-          && (lnum_to_display % display_line_numbers_major_tick == 0))
-   tem_it.face_id = merge_faces (it->w, Qline_number_major_tick,
-                     0, DEFAULT_FACE_ID);
-      else if (display_line_numbers_minor_tick > 0
-          && (lnum_to_display % display_line_numbers_minor_tick == 0))
-   tem_it.face_id = merge_faces (it->w, Qline_number_minor_tick,
-                     0, DEFAULT_FACE_ID);
+      else if (tick_face_id >= 0)
+   tem_it.face_id = tick_face_id;
       else
    tem_it.face_id = lnum_face_id;
       if (beyond_zv

[-- Attachment #2: Type: text/html, Size: 2424 bytes --]

  reply	other threads:[~2019-10-08  4:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07  1:04 bug#37641: major/minor tick faces bleed into empty lines at the end of buffer Juanma Barranquero
2019-10-07  3:42 ` Juanma Barranquero
2019-10-07 16:17   ` Eli Zaretskii
2019-10-08  2:38     ` Juanma Barranquero
2019-10-08  4:23       ` Juanma Barranquero [this message]
2019-10-08  8:51         ` Eli Zaretskii
2019-10-08  8:49       ` Eli Zaretskii
2019-10-08  9:37         ` Juanma Barranquero
2019-10-08 10:47           ` Juanma Barranquero
2019-10-09 10:22             ` Eli Zaretskii
2019-10-09 10:39               ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAeL0SQvcuDRwFDuVK-FwXEeT_JY=Far3qx0uxivF28t7HfgDw@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=37641@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).