diff options
| author | Wolfgang Jenkner | 2015-06-03 15:29:24 +0200 |
|---|---|---|
| committer | Wolfgang Jenkner | 2015-06-03 15:29:24 +0200 |
| commit | 68529c89faf04a638ddea5e910d0684effa1d7c5 (patch) | |
| tree | fedfa586a7d58ed2b716c24a019929019a394854 /src | |
| parent | a62306bbcbd1c0c9c047c62be6ead34cd7be75df (diff) | |
| download | emacs-68529c89faf04a638ddea5e910d0684effa1d7c5.tar.gz emacs-68529c89faf04a638ddea5e910d0684effa1d7c5.zip | |
* 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)
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 13 |
1 files changed, 8 insertions, 5 deletions
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. */) | |||
| 2134 | overshoot_handled = 1; | 2134 | overshoot_handled = 1; |
| 2135 | } | 2135 | } |
| 2136 | else if (IT_CHARPOS (it) == PT - 1 | 2136 | else if (IT_CHARPOS (it) == PT - 1 |
| 2137 | && FETCH_BYTE (PT - 1) == '\n' | 2137 | && FETCH_BYTE (PT_BYTE - 1) == '\n' |
| 2138 | && nlines < 0) | 2138 | && nlines <= 0) |
| 2139 | { | 2139 | { |
| 2140 | /* The position we started from was covered by a display | 2140 | /* The position we started from was covered by a display |
| 2141 | property, so we moved to position before the string, and | 2141 | property, so we moved to position before the string, and |
| 2142 | backed up one line, because the character at PT - 1 is a | 2142 | backed up one line, because the character at PT - 1 is |
| 2143 | newline. So we need one less line to go up. */ | 2143 | a newline. So we need one less line to go up (or exactly |
| 2144 | one line to go down if nlines == 0). */ | ||
| 2144 | nlines++; | 2145 | nlines++; |
| 2145 | /* But we still need to record that one line, in order to | 2146 | /* But we still need to record that one line, in order to |
| 2146 | return the correct value to the caller. */ | 2147 | return the correct value to the caller. */ |
| 2147 | vpos_init = -1; | 2148 | vpos_init = -1; |
| 2149 | |||
| 2150 | overshoot_handled = 1; | ||
| 2148 | } | 2151 | } |
| 2149 | if (lcols_given) | 2152 | if (lcols_given) |
| 2150 | to_x = window_column_x (w, window, extract_float (lcols), lcols); | 2153 | 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. */) | |||
| 2159 | } | 2162 | } |
| 2160 | else if (overshoot_handled) | 2163 | else if (overshoot_handled) |
| 2161 | { | 2164 | { |
| 2162 | it.vpos = 0; | 2165 | it.vpos = vpos_init; |
| 2163 | move_it_by_lines (&it, min (PTRDIFF_MAX, nlines)); | 2166 | move_it_by_lines (&it, min (PTRDIFF_MAX, nlines)); |
| 2164 | } | 2167 | } |
| 2165 | else | 2168 | else |