1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-10 09:43:26 -08:00

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)
This commit is contained in:
Eli Zaretskii 2016-08-08 18:15:55 +03:00
parent e2b7fe4e5a
commit 9fc22fb932

View file

@ -15307,6 +15307,40 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
-1, MOVE_TO_POS | MOVE_TO_Y);
dy = line_bottom_y (&it) - y0;
if (dy > scroll_max)
return SCROLLING_FAILED;
if (dy > 0)
scroll_down_p = true;
}
else if (PT == IT_CHARPOS (it)
&& IT_CHARPOS (it) < ZV
&& it.method == GET_FROM_STRING
&& arg_scroll_conservatively > scroll_limit
&& it.current_x == 0)
{
enum move_it_result skip;
int y1 = it.current_y;
int vpos;
/* A before-string that includes newlines and is displayed
on the last visible screen line could fail us under
scroll-conservatively > 100, because we will be unable to
position the cursor on that last visible line. Try to
recover by finding the first screen line that has some
glyphs coming from the buffer text. */
do {
skip = move_it_in_display_line_to (&it, ZV, -1, MOVE_TO_POS);
if (skip != MOVE_NEWLINE_OR_CR
|| IT_CHARPOS (it) != PT
|| it.method == GET_FROM_BUFFER)
break;
vpos = it.vpos;
move_it_to (&it, -1, -1, -1, vpos + 1, MOVE_TO_VPOS);
} while (it.vpos > vpos);
dy = it.current_y - y1;
if (dy > scroll_max)
return SCROLLING_FAILED;