From 53b15fa6dc1b975a617923ec1da5d1b29a1f6955 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 21 Jun 2014 15:30:02 +0300 Subject: [PATCH] Fix bug #17823 with vertical-motion in lines with line-prefix. 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 | 4 ++++ src/indent.c | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 93a25ba2871..cd82e91c2dd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,10 @@ 2014-06-21 Eli Zaretskii * 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 diff --git a/src/indent.c b/src/indent.c index f492461bf50..711792f75cd 100644 --- a/src/indent.c +++ b/src/indent.c @@ -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)); -- 2.11.4.GIT