diff options
| -rw-r--r-- | src/xdisp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index d23b1768d68..8acba259d2f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20763,13 +20763,7 @@ maybe_produce_line_number (struct it *it) | |||
| 20763 | matrix. */ | 20763 | matrix. */ |
| 20764 | ptrdiff_t max_lnum; | 20764 | ptrdiff_t max_lnum; |
| 20765 | 20765 | ||
| 20766 | if (EQ (Vdisplay_line_numbers, Qrelative)) | 20766 | max_lnum = this_line + it->w->desired_matrix->nrows - 1 - it->vpos; |
| 20767 | /* We subtract one more because the current line is | ||
| 20768 | always zero under relative line-number display. */ | ||
| 20769 | max_lnum = it->w->desired_matrix->nrows - 2; | ||
| 20770 | else | ||
| 20771 | max_lnum = | ||
| 20772 | this_line + it->w->desired_matrix->nrows - 1 - it->vpos; | ||
| 20773 | max_lnum = max (1, max_lnum); | 20767 | max_lnum = max (1, max_lnum); |
| 20774 | it->lnum_width = log10 (max_lnum) + 1; | 20768 | it->lnum_width = log10 (max_lnum) + 1; |
| 20775 | } | 20769 | } |
| @@ -20778,12 +20772,18 @@ maybe_produce_line_number (struct it *it) | |||
| 20778 | if (EQ (Vdisplay_line_numbers, Qrelative)) | 20772 | if (EQ (Vdisplay_line_numbers, Qrelative)) |
| 20779 | lnum_offset = it->pt_lnum; | 20773 | lnum_offset = it->pt_lnum; |
| 20780 | 20774 | ||
| 20775 | /* Under 'relative', display the absolute line number for the | ||
| 20776 | current line, as displaying zero gives zero useful information. */ | ||
| 20777 | ptrdiff_t lnum_to_display = eabs (this_line - lnum_offset); | ||
| 20778 | if (EQ (Vdisplay_line_numbers, Qrelative) | ||
| 20779 | && lnum_to_display == 0) | ||
| 20780 | lnum_to_display = it->pt_lnum + 1; | ||
| 20781 | /* In L2R rows we need to append the blank separator, in R2L | 20781 | /* In L2R rows we need to append the blank separator, in R2L |
| 20782 | rows we need to prepend it. But this function is usually | 20782 | rows we need to prepend it. But this function is usually |
| 20783 | called when no display elements were produced from the | 20783 | called when no display elements were produced from the |
| 20784 | following line, so the paragraph direction might be unknown. | 20784 | following line, so the paragraph direction might be unknown. |
| 20785 | Therefore we cheat and add 2 blanks, one on either side. */ | 20785 | Therefore we cheat and add 2 blanks, one on either side. */ |
| 20786 | pint2str (lnum_buf, it->lnum_width + 1, eabs (this_line - lnum_offset)); | 20786 | pint2str (lnum_buf, it->lnum_width + 1, lnum_to_display); |
| 20787 | strcat (lnum_buf, " "); | 20787 | strcat (lnum_buf, " "); |
| 20788 | 20788 | ||
| 20789 | /* Setup for producing the glyphs. */ | 20789 | /* Setup for producing the glyphs. */ |