diff options
| -rw-r--r-- | src/dispextern.h | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 08e5caa893b..84a27169ea1 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2667,9 +2667,10 @@ struct it | |||
| 2667 | /* The byte position corresponding to lnum. */ | 2667 | /* The byte position corresponding to lnum. */ |
| 2668 | ptrdiff_t lnum_bytepos; | 2668 | ptrdiff_t lnum_bytepos; |
| 2669 | 2669 | ||
| 2670 | /* The width in columns needed for display of the line numbers, or | 2670 | /* The width, in columns and in pixels, needed for display of the |
| 2671 | zero if not computed. */ | 2671 | line numbers, or zero if not computed. */ |
| 2672 | int lnum_width; | 2672 | int lnum_width; |
| 2673 | int lnum_pixel_width; | ||
| 2673 | 2674 | ||
| 2674 | /* The line number of point's line, or zero if not computed yet. */ | 2675 | /* The line number of point's line, or zero if not computed yet. */ |
| 2675 | ptrdiff_t pt_lnum; | 2676 | ptrdiff_t pt_lnum; |
diff --git a/src/xdisp.c b/src/xdisp.c index bbf30504844..3fc5f29d0c4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20938,6 +20938,8 @@ maybe_produce_line_number (struct it *it) | |||
| 20938 | } | 20938 | } |
| 20939 | } | 20939 | } |
| 20940 | 20940 | ||
| 20941 | /* Record the width in pixels we need for the line number display. */ | ||
| 20942 | it->lnum_pixel_width = tem_it.current_x; | ||
| 20941 | /* Copy the produced glyphs into IT's glyph_row. */ | 20943 | /* Copy the produced glyphs into IT's glyph_row. */ |
| 20942 | struct glyph *g = scratch_glyph_row.glyphs[TEXT_AREA]; | 20944 | struct glyph *g = scratch_glyph_row.glyphs[TEXT_AREA]; |
| 20943 | struct glyph *e = g + scratch_glyph_row.used[TEXT_AREA]; | 20945 | struct glyph *e = g + scratch_glyph_row.used[TEXT_AREA]; |
| @@ -27997,13 +27999,12 @@ x_produce_glyphs (struct it *it) | |||
| 27997 | int tab_width = it->tab_width * font->space_width; | 27999 | int tab_width = it->tab_width * font->space_width; |
| 27998 | int x = it->current_x + it->continuation_lines_width; | 28000 | int x = it->current_x + it->continuation_lines_width; |
| 27999 | int x0 = x; | 28001 | int x0 = x; |
| 28000 | /* Adjust for line numbers. Kludge alert: the "2" below | 28002 | /* Adjust for line numbers, if needed. */ |
| 28001 | is because we add 2 blanks to the actual line number. */ | ||
| 28002 | if (!NILP (Vdisplay_line_numbers)) | 28003 | if (!NILP (Vdisplay_line_numbers)) |
| 28003 | x -= (it->lnum_width + 2) * font->space_width; | 28004 | x -= it->lnum_pixel_width; |
| 28004 | int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; | 28005 | int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
| 28005 | if (!NILP (Vdisplay_line_numbers)) | 28006 | if (!NILP (Vdisplay_line_numbers)) |
| 28006 | next_tab_x += (it->lnum_width + 2) * font->space_width; | 28007 | next_tab_x += it->lnum_pixel_width; |
| 28007 | 28008 | ||
| 28008 | /* If the distance from the current position to the next tab | 28009 | /* If the distance from the current position to the next tab |
| 28009 | stop is less than a space character width, use the | 28010 | stop is less than a space character width, use the |