diff options
| author | Eli Zaretskii | 2017-06-25 19:33:04 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-06-25 19:33:04 +0300 |
| commit | 540669cda984f64964d7baeb7369d3eea424a34c (patch) | |
| tree | 1bb735e8c8f8ebcfaaaa24f7a0e5b3e6a59b2588 /src | |
| parent | 16d2695674a4c8abbec846c427fe8abef97e07ef (diff) | |
| download | emacs-540669cda984f64964d7baeb7369d3eea424a34c.tar.gz emacs-540669cda984f64964d7baeb7369d3eea424a34c.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 15 |
1 files changed, 12 insertions, 3 deletions
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) | |||
| 20749 | ptrdiff_t last_line = it->lnum; | 20749 | ptrdiff_t last_line = it->lnum; |
| 20750 | ptrdiff_t start_from, bytepos; | 20750 | ptrdiff_t start_from, bytepos; |
| 20751 | ptrdiff_t this_line; | 20751 | ptrdiff_t this_line; |
| 20752 | bool first_time = false; | ||
| 20752 | 20753 | ||
| 20753 | /* FIXME: Maybe reuse the data in it->w->base_line_number. */ | 20754 | /* FIXME: Maybe reuse the data in it->w->base_line_number. */ |
| 20754 | if (!last_line) | 20755 | if (!last_line) |
| 20755 | start_from = BEGV; | 20756 | { |
| 20757 | start_from = BEGV; | ||
| 20758 | if (!it->lnum_bytepos) | ||
| 20759 | first_time = true; | ||
| 20760 | } | ||
| 20756 | else | 20761 | else |
| 20757 | start_from = it->lnum_bytepos; | 20762 | start_from = it->lnum_bytepos; |
| 20758 | 20763 | ||
| @@ -20772,13 +20777,14 @@ maybe_produce_line_number (struct it *it) | |||
| 20772 | eassert (this_line > 0 || (this_line == 0 && start_from == BEGV_BYTE)); | 20777 | eassert (this_line > 0 || (this_line == 0 && start_from == BEGV_BYTE)); |
| 20773 | eassert (bytepos == IT_BYTEPOS (*it)); | 20778 | eassert (bytepos == IT_BYTEPOS (*it)); |
| 20774 | 20779 | ||
| 20775 | /* Produce the glyphs for the line number. */ | 20780 | /* Record the line number information. */ |
| 20776 | if (this_line != last_line || !last_line) | 20781 | if (this_line != last_line || !last_line) |
| 20777 | { | 20782 | { |
| 20778 | it->lnum = this_line; | 20783 | it->lnum = this_line; |
| 20779 | it->lnum_bytepos = IT_BYTEPOS (*it); | 20784 | it->lnum_bytepos = IT_BYTEPOS (*it); |
| 20780 | } | 20785 | } |
| 20781 | 20786 | ||
| 20787 | /* Produce the glyphs for the line number. */ | ||
| 20782 | void *itdata = bidi_shelve_cache (); | 20788 | void *itdata = bidi_shelve_cache (); |
| 20783 | struct it tem_it; | 20789 | struct it tem_it; |
| 20784 | char lnum_buf[INT_STRLEN_BOUND (ptrdiff_t) + 1]; | 20790 | char lnum_buf[INT_STRLEN_BOUND (ptrdiff_t) + 1]; |
| @@ -20864,7 +20870,10 @@ maybe_produce_line_number (struct it *it) | |||
| 20864 | tem_it.face_id = current_lnum_face_id; | 20870 | tem_it.face_id = current_lnum_face_id; |
| 20865 | else | 20871 | else |
| 20866 | tem_it.face_id = lnum_face_id; | 20872 | tem_it.face_id = lnum_face_id; |
| 20867 | if (beyond_zv || it->continuation_lines_width > 0) | 20873 | if (beyond_zv |
| 20874 | /* Don't display the same line number more than once. */ | ||
| 20875 | || it->continuation_lines_width > 0 | ||
| 20876 | || (this_line == last_line && !first_time)) | ||
| 20868 | tem_it.c = tem_it.char_to_display = ' '; | 20877 | tem_it.c = tem_it.char_to_display = ' '; |
| 20869 | else | 20878 | else |
| 20870 | tem_it.c = tem_it.char_to_display = *p; | 20879 | tem_it.c = tem_it.char_to_display = *p; |