emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/line-numbers b5ce310: Improve display of tabs with


From: Eli Zaretskii
Subject: [Emacs-diffs] scratch/line-numbers b5ce310: Improve display of tabs with line numbers
Date: Sat, 1 Jul 2017 09:01:15 -0400 (EDT)

branch: scratch/line-numbers
commit b5ce3100a8549df519d6f2b577fe7c3acf90cb40
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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.
---
 src/xdisp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 7bbe9d9..47b8141 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -28028,18 +28028,19 @@ x_produce_glyphs (struct it *it)
              int x = it->current_x + it->continuation_lines_width;
              int x0 = x;
              /* Adjust for line numbers, if needed.   */
-             if (!NILP (Vdisplay_line_numbers))
+             if (!NILP (Vdisplay_line_numbers) && x0 >= it->lnum_pixel_width)
                x -= it->lnum_pixel_width;
              int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * 
tab_width;
-             if (!NILP (Vdisplay_line_numbers))
-               next_tab_x += (it->lnum_pixel_width
-                              - it->w->hscroll * font->space_width);
 
              /* If the distance from the current position to the next tab
                 stop is less than a space character width, use the
                 tab stop after that.  */
              if (next_tab_x - x0 < font->space_width)
                next_tab_x += tab_width;
+             if (!NILP (Vdisplay_line_numbers) && x0 >= it->lnum_pixel_width)
+               next_tab_x += (it->lnum_pixel_width
+                              - ((it->w->hscroll * font->space_width)
+                                 % tab_width));
 
              it->pixel_width = next_tab_x - x0;
              it->nglyphs = 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]