]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #17969 with vertical-motion through continuation lines with TABs.
authorEli Zaretskii <eliz@gnu.org>
Tue, 8 Jul 2014 15:12:39 +0000 (18:12 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 8 Jul 2014 15:12:39 +0000 (18:12 +0300)
 src/xdisp.c (move_it_to): Adjust calculation of line_start_x to what
 x_produce_glyphs does when it generates a stretch glyph that
 represents a TAB.

src/ChangeLog
src/xdisp.c

index 89621bd54ec3eea09818b2c7ee162ba35c4ecbe8..d2f1999b546d9883cc6850640f9cb952fab349e8 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (move_it_to): Adjust calculation of line_start_x to what
+       x_produce_glyphs does when it generates a stretch glyph that
+       represents a TAB.  (Bug#17969)
+
 2014-07-05  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (pos_visible_p): If CHARPOS is at beginning of window,
index 28752a42cb92e327c4c8963f845f4f07c7e2e52e..61d1fa24c6855423f92099d1fb5f5ee0b9901682 100644 (file)
@@ -9250,6 +9250,25 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
                {
                  line_start_x = it->current_x + it->pixel_width
                    - it->last_visible_x;
+                 if (FRAME_WINDOW_P (it->f))
+                   {
+                     struct face *face = FACE_FROM_ID (it->f, it->face_id);
+                     struct font *face_font = face->font;
+
+                     /* When display_line produces a continued line
+                        that ends in a TAB, it skips a tab stop that
+                        is closer than the font's space character
+                        width (see x_produce_glyphs where it produces
+                        the stretch glyph which represents a TAB).
+                        We need to reproduce the same logic here.  */
+                     eassert (face_font);
+                     if (face_font)
+                       {
+                         if (line_start_x < face_font->space_width)
+                           line_start_x
+                             += it->tab_width * face_font->space_width;
+                       }
+                   }
                  set_iterator_to_next (it, 0);
                }
            }