From 281ae1808d7b470e0aa11858ea0b3100d20d1694 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 8 Mar 2014 15:18:43 +0200 Subject: [PATCH] src/xdisp.c (Fmove_point_visually): Fix previous change. Fixes: debbugs:16961 --- src/xdisp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xdisp.c b/src/xdisp.c index 62915438e50..0216aaea116 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20880,7 +20880,10 @@ Value is the new character position of point. */) SAVE_IT (it2, it, it_data); move_it_in_display_line_to (&it, ZV, target_x, MOVE_TO_POS | MOVE_TO_X); - target_x = it.current_x - 1; + /* If we arrived at target_x, that _is_ the last + character on the previous line. */ + if (it.current_x != target_x) + target_x = it.current_x - 1; RESTORE_IT (&it, &it2, it_data); } } -- 2.39.2