]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #17823 with vertical-motion in lines with line-prefix.
authorEli Zaretskii <eliz@gnu.org>
Sat, 21 Jun 2014 12:30:02 +0000 (15:30 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 21 Jun 2014 12:30:02 +0000 (15:30 +0300)
 src/indent.c (Fvertical_motion): Move to the goal column, if any,
 with a single call to move_it_in_display_line, not in two calls.
 Doing this with two calls causes move_it_in_display_line apply the
 line-prefix handling twice instead of just once.

src/ChangeLog
src/indent.c

index 93a25ba2871c69bb0c6d83e242a01592ea89c3ab..cd82e91c2dd0405090f0086da412733fdbcf3a40 100644 (file)
@@ -1,6 +1,10 @@
 2014-06-21  Eli Zaretskii  <eliz@gnu.org>
 
        * indent.c (Fvertical_motion): Doc fix.
+       Move to the goal column, if any, with a single call to
+       move_it_in_display_line, not in two calls.  Doing this with two
+       calls causes move_it_in_display_line apply the line-prefix
+       handling twice instead of just once.  (Bug#17823)
 
 2014-06-21  Paul Eggert  <eggert@cs.ucla.edu>
 
index f492461bf50b798609f582ffb6b9934c55d6a603..711792f75cd9c5d3520823888cb8114e082ad2a7 100644 (file)
@@ -2129,20 +2129,14 @@ whether or not it is currently displayed in some window.  */)
            }
        }
 
-      /* Move to the goal column, if one was specified.  */
+      /* Move to the goal column, if one was specified.  If the window
+        was originally hscrolled, the goal column is interpreted as
+        an addition to the hscroll amount.  */
       if (!NILP (lcols))
        {
-         /* If the window was originally hscrolled, move forward by
-            the hscrolled amount first.  */
-         if (first_x > 0)
-           {
-             move_it_in_display_line (&it, ZV, first_x, MOVE_TO_X);
-             it.current_x = 0;
-           }
-         move_it_in_display_line
-           (&it, ZV,
-            (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5),
-            MOVE_TO_X);
+         int to_x = (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5);
+
+         move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X);
        }
 
       SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));