From: Wolfgang Jenkner Date: Wed, 3 Jun 2015 13:29:24 +0000 (+0200) Subject: * src/indent.c (Fvertical_motion): Amend motion by 0 lines. X-Git-Tag: emacs-25.0.90~1880 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=68529c89faf04a638ddea5e910d0684effa1d7c5;p=emacs.git * src/indent.c (Fvertical_motion): Amend motion by 0 lines. Starting from a display string after a newline, point went to the previous line. Also, fix an inadvertent use of a buffer position with FETCH_BYTE. (Bug#20701) --- diff --git a/src/indent.c b/src/indent.c index ce78308c95b..b4e6d745499 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2134,17 +2134,20 @@ whether or not it is currently displayed in some window. */) overshoot_handled = 1; } else if (IT_CHARPOS (it) == PT - 1 - && FETCH_BYTE (PT - 1) == '\n' - && nlines < 0) + && FETCH_BYTE (PT_BYTE - 1) == '\n' + && nlines <= 0) { /* The position we started from was covered by a display property, so we moved to position before the string, and - backed up one line, because the character at PT - 1 is a - newline. So we need one less line to go up. */ + backed up one line, because the character at PT - 1 is + a newline. So we need one less line to go up (or exactly + one line to go down if nlines == 0). */ nlines++; /* But we still need to record that one line, in order to return the correct value to the caller. */ vpos_init = -1; + + overshoot_handled = 1; } if (lcols_given) to_x = window_column_x (w, window, extract_float (lcols), lcols); @@ -2159,7 +2162,7 @@ whether or not it is currently displayed in some window. */) } else if (overshoot_handled) { - it.vpos = 0; + it.vpos = vpos_init; move_it_by_lines (&it, min (PTRDIFF_MAX, nlines)); } else