aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index bcd7d33332f..aeccac2cb16 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20867,26 +20867,23 @@ maybe_produce_line_number (struct it *it)
20867 { 20867 {
20868 if (NATNUMP (Vdisplay_line_number_width)) 20868 if (NATNUMP (Vdisplay_line_number_width))
20869 it->lnum_width = XFASTINT (Vdisplay_line_number_width); 20869 it->lnum_width = XFASTINT (Vdisplay_line_number_width);
20870
20871 /* Max line number to be displayed cannot be more than the one
20872 corresponding to the last row of the desired matrix. */
20873 ptrdiff_t max_lnum;
20874
20875 if (NILP (Vdisplay_line_numbers_current_absolute)
20876 && (EQ (Vdisplay_line_numbers, Qrelative)
20877 || EQ (Vdisplay_line_numbers, Qvisual)))
20878 /* We subtract one more because the current line is always
20879 zero in this mode. */
20880 max_lnum = it->w->desired_matrix->nrows - 2;
20881 else if (EQ (Vdisplay_line_numbers, Qvisual))
20882 max_lnum = it->pt_lnum + it->w->desired_matrix->nrows - 1;
20870 else 20883 else
20871 { 20884 max_lnum = this_line + it->w->desired_matrix->nrows - 1 - it->vpos;
20872 /* Max line number to be displayed cannot be more than 20885 max_lnum = max (1, max_lnum);
20873 the one corresponding to the last row of the desired 20886 it->lnum_width = max (it->lnum_width, log10 (max_lnum) + 1);
20874 matrix. */
20875 ptrdiff_t max_lnum;
20876
20877 if (NILP (Vdisplay_line_numbers_current_absolute)
20878 && (EQ (Vdisplay_line_numbers, Qrelative)
20879 || EQ (Vdisplay_line_numbers, Qvisual)))
20880 /* We subtract one more because the current line is always
20881 zero in this mode. */
20882 max_lnum = it->w->desired_matrix->nrows - 2;
20883 else if (EQ (Vdisplay_line_numbers, Qvisual))
20884 max_lnum = it->pt_lnum + it->w->desired_matrix->nrows - 1;
20885 else
20886 max_lnum = this_line + it->w->desired_matrix->nrows - 1 - it->vpos;
20887 max_lnum = max (1, max_lnum);
20888 it->lnum_width = log10 (max_lnum) + 1;
20889 }
20890 eassert (it->lnum_width > 0); 20887 eassert (it->lnum_width > 0);
20891 } 20888 }
20892 if (EQ (Vdisplay_line_numbers, Qrelative)) 20889 if (EQ (Vdisplay_line_numbers, Qrelative))