aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2017-07-01 16:00:18 +0300
committerEli Zaretskii2017-07-01 16:00:18 +0300
commitb5ce3100a8549df519d6f2b577fe7c3acf90cb40 (patch)
tree614e9858b20334619399663b2fb10eeafb1682bc
parentfb62728b7afa7024d4ca01e6f89b0267231cf607 (diff)
downloademacs-b5ce3100a8549df519d6f2b577fe7c3acf90cb40.tar.gz
emacs-b5ce3100a8549df519d6f2b577fe7c3acf90cb40.zip
Improve display of tabs with line numbers
* src/xdisp.c (x_produce_glyphs): Improve calculation of next tab stop in hscrolled lines. Prevent aborts in compute_line_metrics.
-rw-r--r--src/xdisp.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 7bbe9d9ca3e..47b81414630 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -28028,18 +28028,19 @@ x_produce_glyphs (struct it *it)
28028 int x = it->current_x + it->continuation_lines_width; 28028 int x = it->current_x + it->continuation_lines_width;
28029 int x0 = x; 28029 int x0 = x;
28030 /* Adjust for line numbers, if needed. */ 28030 /* Adjust for line numbers, if needed. */
28031 if (!NILP (Vdisplay_line_numbers)) 28031 if (!NILP (Vdisplay_line_numbers) && x0 >= it->lnum_pixel_width)
28032 x -= it->lnum_pixel_width; 28032 x -= it->lnum_pixel_width;
28033 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; 28033 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;
28034 if (!NILP (Vdisplay_line_numbers))
28035 next_tab_x += (it->lnum_pixel_width
28036 - it->w->hscroll * font->space_width);
28037 28034
28038 /* If the distance from the current position to the next tab 28035 /* If the distance from the current position to the next tab
28039 stop is less than a space character width, use the 28036 stop is less than a space character width, use the
28040 tab stop after that. */ 28037 tab stop after that. */
28041 if (next_tab_x - x0 < font->space_width) 28038 if (next_tab_x - x0 < font->space_width)
28042 next_tab_x += tab_width; 28039 next_tab_x += tab_width;
28040 if (!NILP (Vdisplay_line_numbers) && x0 >= it->lnum_pixel_width)
28041 next_tab_x += (it->lnum_pixel_width
28042 - ((it->w->hscroll * font->space_width)
28043 % tab_width));
28043 28044
28044 it->pixel_width = next_tab_x - x0; 28045 it->pixel_width = next_tab_x - x0;
28045 it->nglyphs = 1; 28046 it->nglyphs = 1;