aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2017-06-24 14:29:32 +0300
committerEli Zaretskii2017-06-24 14:29:32 +0300
commit55a9298d63121578cd66ef7f14c14b2160aae77d (patch)
tree5da5351c03a2b000952a6a17cbdd515667be3bcc /src
parent7d7602cea09692eddb6a8d16f7786b5086a01091 (diff)
downloademacs-55a9298d63121578cd66ef7f14c14b2160aae77d.tar.gz
emacs-55a9298d63121578cd66ef7f14c14b2160aae77d.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/term.c4
-rw-r--r--src/xdisp.c4
2 files changed, 8 insertions, 0 deletions
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)
1584 { 1584 {
1585 int absolute_x = (it->current_x 1585 int absolute_x = (it->current_x
1586 + it->continuation_lines_width); 1586 + it->continuation_lines_width);
1587 /* Adjust for line numbers. Kludge alert: the "2" below is
1588 because we add 2 blanks to the actual line number. */
1589 if (!NILP (Vdisplay_line_numbers))
1590 absolute_x -= it->lnum_width + 2;
1587 int next_tab_x 1591 int next_tab_x
1588 = (((1 + absolute_x + it->tab_width - 1) 1592 = (((1 + absolute_x + it->tab_width - 1)
1589 / it->tab_width) 1593 / 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)
27865 { 27865 {
27866 int tab_width = it->tab_width * font->space_width; 27866 int tab_width = it->tab_width * font->space_width;
27867 int x = it->current_x + it->continuation_lines_width; 27867 int x = it->current_x + it->continuation_lines_width;
27868 /* Adjust for line numbers. Kludge alert: the "2" below
27869 is because we add 2 blanks to the actual line number. */
27870 if (!NILP (Vdisplay_line_numbers))
27871 x -= (it->lnum_width + 2) * font->space_width;
27868 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; 27872 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;
27869 27873
27870 /* If the distance from the current position to the next tab 27874 /* If the distance from the current position to the next tab