diff options
| author | Eli Zaretskii | 2018-06-06 18:28:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-06-06 18:28:44 +0300 |
| commit | e5ab25deaeb5daf58d2e3b0c990cd67e6020bb38 (patch) | |
| tree | 581e449920bba48915918905bd040926868c65e1 /src | |
| parent | d20beef5f104909f765430e347f5f3711ea51149 (diff) | |
| download | emacs-e5ab25deaeb5daf58d2e3b0c990cd67e6020bb38.tar.gz emacs-e5ab25deaeb5daf58d2e3b0c990cd67e6020bb38.zip | |
Fix cursor movement by 'next-logical-line' after 'next-line'
* src/indent.c (Fvertical_motion): Adjust TO_X when line-numbers
are being displayed. Remove unneeded "correction" of TO_X at the
goal line.
* lisp/simple.el (last--line-number-width): Remove unneeded
variable.
(line-move-visual): Account for line-number display width by
adjusting the pixel X coordinate that gets converted into
canonical columns passed to vertical-motion, instead of adjusting
temporary-goal-column (which then affects next commands, including
next-logical-line). (Bug#31723)
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/indent.c b/src/indent.c index 316171e609b..bcffa0d11e5 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -2278,7 +2278,9 @@ whether or not it is currently displayed in some window. */) | |||
| 2278 | overshoot_handled = 1; | 2278 | overshoot_handled = 1; |
| 2279 | } | 2279 | } |
| 2280 | if (lcols_given) | 2280 | if (lcols_given) |
| 2281 | to_x = window_column_x (w, window, extract_float (lcols), lcols); | 2281 | to_x = |
| 2282 | window_column_x (w, window, extract_float (lcols), lcols) | ||
| 2283 | + lnum_pixel_width; | ||
| 2282 | if (nlines <= 0) | 2284 | if (nlines <= 0) |
| 2283 | { | 2285 | { |
| 2284 | it.vpos = vpos_init; | 2286 | it.vpos = vpos_init; |
| @@ -2330,12 +2332,6 @@ whether or not it is currently displayed in some window. */) | |||
| 2330 | an addition to the hscroll amount. */ | 2332 | an addition to the hscroll amount. */ |
| 2331 | if (lcols_given) | 2333 | if (lcols_given) |
| 2332 | { | 2334 | { |
| 2333 | /* If we are displaying line numbers, we could cross the | ||
| 2334 | line where the width of the line-number display changes, | ||
| 2335 | in which case we need to fix up the pixel coordinate | ||
| 2336 | accordingly. */ | ||
| 2337 | if (lnum_pixel_width > 0) | ||
| 2338 | to_x += it.lnum_pixel_width - lnum_pixel_width; | ||
| 2339 | move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X); | 2335 | move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X); |
| 2340 | /* If we find ourselves in the middle of an overlay string | 2336 | /* If we find ourselves in the middle of an overlay string |
| 2341 | which includes a newline after current string position, | 2337 | which includes a newline after current string position, |