From: Eli Zaretskii Date: Sat, 24 Jun 2017 11:29:32 +0000 (+0300) Subject: Fix tab stops when line numbers are displayed X-Git-Tag: emacs-26.0.90~518^2~156^2~30 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=55a9298d63121578cd66ef7f14c14b2160aae77d;p=emacs.git Fix tab stops when line numbers are displayed * src/xdisp.c (x_produce_glyphs): * src/term.c (produce_glyphs): Adjust tab stops for the horizontal space taken by the line-number display. --- diff --git a/src/term.c b/src/term.c index 8770aff8a92..b0e7e052e51 100644 --- a/src/term.c +++ b/src/term.c @@ -1584,6 +1584,10 @@ produce_glyphs (struct it *it) { int absolute_x = (it->current_x + it->continuation_lines_width); + /* Adjust for line numbers. Kludge alert: the "2" below is + because we add 2 blanks to the actual line number. */ + if (!NILP (Vdisplay_line_numbers)) + absolute_x -= it->lnum_width + 2; int next_tab_x = (((1 + absolute_x + it->tab_width - 1) / it->tab_width) diff --git a/src/xdisp.c b/src/xdisp.c index f98e7a9ac7e..5f86f0bfde6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -27865,6 +27865,10 @@ x_produce_glyphs (struct it *it) { int tab_width = it->tab_width * font->space_width; int x = it->current_x + it->continuation_lines_width; + /* Adjust for line numbers. Kludge alert: the "2" below + is because we add 2 blanks to the actual line number. */ + if (!NILP (Vdisplay_line_numbers)) + x -= (it->lnum_width + 2) * font->space_width; int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; /* If the distance from the current position to the next tab