Fix failures in try_scrolling when scrolling back.

src/xdisp.c (try_scrolling): When point is above the window, allow
 searching as far as scroll_max, or one screenful, to compute
 vertical distance from PT to the scroll margin position.  This
 prevents try_scrolling from unnecessarily failing when
 scroll-conservatively is set to a value slightly larger than the
 window height.
This commit is contained in:
Eli Zaretskii 2011-03-28 21:30:35 +02:00
parent fd738ca513
commit 9f3842cef7
2 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2011-03-28 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (try_scrolling): When point is above the window, allow
searching as far as scroll_max, or one screenful, to compute
vertical distance from PT to the scroll margin position. This
prevents try_scrolling from unnecessarily failing when
scroll-conservatively is set to a value slightly larger than the
window height.
2011-03-27 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (try_scrolling): Clean up the case of PT below the

View file

@ -13176,16 +13176,19 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
{
/* Point is in the scroll margin at the top of the window or
above what is displayed in the window. */
int y0;
int y0, y_to_move;
/* Compute the vertical distance from PT to the scroll
margin position. Give up if distance is greater than
scroll_max. */
margin position. Move as far as scroll_max allows, or
one screenful, or 10 screen lines, whichever is largest.
Give up if distance is greater than scroll_max. */
SET_TEXT_POS (pos, PT, PT_BYTE);
start_display (&it, w, pos);
y0 = it.current_y;
y_to_move = max (it.last_visible_y,
max (scroll_max, 10 * FRAME_LINE_HEIGHT (f)));
move_it_to (&it, CHARPOS (scroll_margin_pos), 0,
it.last_visible_y, -1,
y_to_move, -1,
MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
dy = it.current_y - y0;
if (dy > scroll_max)