emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/line-numbers 540669c: Fix line number display for


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/line-numbers 540669c: Fix line number display for overlay/display strings with newlines
Date: Sun, 25 Jun 2017 12:35:31 -0400 (EDT)

branch: scratch/line-numbers
commit 540669cda984f64964d7baeb7369d3eea424a34c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix line number display for overlay/display strings with newlines
    
    * src/xdisp.c (maybe_produce_line_number): Fix the condition for
    producing space glyphs instead of a line number to include the
    case of display strings and overlays.
---
 src/xdisp.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 6fa1d84..c318a69 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20749,10 +20749,15 @@ maybe_produce_line_number (struct it *it)
   ptrdiff_t last_line = it->lnum;
   ptrdiff_t start_from, bytepos;
   ptrdiff_t this_line;
+  bool first_time = false;
 
   /* FIXME: Maybe reuse the data in it->w->base_line_number.  */
   if (!last_line)
-    start_from = BEGV;
+    {
+      start_from = BEGV;
+      if (!it->lnum_bytepos)
+       first_time = true;
+    }
   else
     start_from = it->lnum_bytepos;
 
@@ -20772,13 +20777,14 @@ maybe_produce_line_number (struct it *it)
   eassert (this_line > 0 || (this_line == 0 && start_from == BEGV_BYTE));
   eassert (bytepos == IT_BYTEPOS (*it));
 
-  /* Produce the glyphs for the line number.  */
+  /* Record the line number information.  */
   if (this_line != last_line || !last_line)
     {
       it->lnum = this_line;
       it->lnum_bytepos = IT_BYTEPOS (*it);
     }
 
+  /* Produce the glyphs for the line number.  */
   void *itdata = bidi_shelve_cache ();
   struct it tem_it;
   char lnum_buf[INT_STRLEN_BOUND (ptrdiff_t) + 1];
@@ -20864,7 +20870,10 @@ maybe_produce_line_number (struct it *it)
        tem_it.face_id = current_lnum_face_id;
       else
        tem_it.face_id = lnum_face_id;
-      if (beyond_zv || it->continuation_lines_width > 0)
+      if (beyond_zv
+         /* Don't display the same line number more than once.  */
+         || it->continuation_lines_width > 0
+         || (this_line == last_line && !first_time))
        tem_it.c = tem_it.char_to_display = ' ';
       else
        tem_it.c = tem_it.char_to_display = *p;



reply via email to

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