diff options
| author | Eli Zaretskii | 2016-08-08 18:15:55 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2016-08-08 18:15:55 +0300 |
| commit | 9fc22fb932599fe4fecffffa920abe509ab5cbb0 (patch) | |
| tree | 96b2bd8d9348ebcc2f817b5cb683030838587324 /src | |
| parent | e2b7fe4e5ad532085d8f3a0227be9f37d7f8e1a7 (diff) | |
| download | emacs-9fc22fb932599fe4fecffffa920abe509ab5cbb0.tar.gz emacs-9fc22fb932599fe4fecffffa920abe509ab5cbb0.zip | |
Fix cursor position under scroll-conservatively and overlay strings
* src/xdisp.c (try_scrolling): Handle the case where the last
visible screen line of a window displays a before- or after-string
that takes up the whole screen line, and therefore there's no
place to display the cursor, even though the window does seem to
include the position of point. (Bug#24179)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index efd5f54fa39..21fc01f1e69 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -15313,6 +15313,40 @@ try_scrolling (Lisp_Object window, bool just_this_one_p, | |||
| 15313 | if (dy > 0) | 15313 | if (dy > 0) |
| 15314 | scroll_down_p = true; | 15314 | scroll_down_p = true; |
| 15315 | } | 15315 | } |
| 15316 | else if (PT == IT_CHARPOS (it) | ||
| 15317 | && IT_CHARPOS (it) < ZV | ||
| 15318 | && it.method == GET_FROM_STRING | ||
| 15319 | && arg_scroll_conservatively > scroll_limit | ||
| 15320 | && it.current_x == 0) | ||
| 15321 | { | ||
| 15322 | enum move_it_result skip; | ||
| 15323 | int y1 = it.current_y; | ||
| 15324 | int vpos; | ||
| 15325 | |||
| 15326 | /* A before-string that includes newlines and is displayed | ||
| 15327 | on the last visible screen line could fail us under | ||
| 15328 | scroll-conservatively > 100, because we will be unable to | ||
| 15329 | position the cursor on that last visible line. Try to | ||
| 15330 | recover by finding the first screen line that has some | ||
| 15331 | glyphs coming from the buffer text. */ | ||
| 15332 | do { | ||
| 15333 | skip = move_it_in_display_line_to (&it, ZV, -1, MOVE_TO_POS); | ||
| 15334 | if (skip != MOVE_NEWLINE_OR_CR | ||
| 15335 | || IT_CHARPOS (it) != PT | ||
| 15336 | || it.method == GET_FROM_BUFFER) | ||
| 15337 | break; | ||
| 15338 | vpos = it.vpos; | ||
| 15339 | move_it_to (&it, -1, -1, -1, vpos + 1, MOVE_TO_VPOS); | ||
| 15340 | } while (it.vpos > vpos); | ||
| 15341 | |||
| 15342 | dy = it.current_y - y1; | ||
| 15343 | |||
| 15344 | if (dy > scroll_max) | ||
| 15345 | return SCROLLING_FAILED; | ||
| 15346 | |||
| 15347 | if (dy > 0) | ||
| 15348 | scroll_down_p = true; | ||
| 15349 | } | ||
| 15316 | } | 15350 | } |
| 15317 | 15351 | ||
| 15318 | if (scroll_down_p) | 15352 | if (scroll_down_p) |