From: Eli Zaretskii Date: Sun, 25 Jun 2017 16:33:04 +0000 (+0300) Subject: Fix line number display for overlay/display strings with newlines X-Git-Tag: emacs-26.0.90~518^2~156^2~21 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=540669cda984f64964d7baeb7369d3eea424a34c;p=emacs.git 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. --- diff --git a/src/xdisp.c b/src/xdisp.c index 6fa1d841ee2..c318a6954c4 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;