# HG changeset patch # User Eli Zaretskii # Date 1277057070 -10800 # Node ID 9f55c53fc33a3e1d041ff19574d3742601a1a1ba # Parent 858e3e43cfd5f90263d2bfacccb7c0bfb5ff03fd Avoid recentering when lines differ in their height. xdisp.c (try_scrolling): When scroll-conservatively is set to most-positive-fixnum, be extra accurate when scrolling window start, to avoid missing the cursor line. diff -r 858e3e43cfd5 -r 9f55c53fc33a src/ChangeLog --- a/src/ChangeLog Sun Jun 20 00:55:14 2010 -0400 +++ b/src/ChangeLog Sun Jun 20 21:04:30 2010 +0300 @@ -1,3 +1,9 @@ +2010-06-20 Eli Zaretskii + + * xdisp.c (try_scrolling): When scroll-conservatively is set to + most-positive-fixnum, be extra accurate when scrolling window + start, to avoid missing the cursor line. + 2010-06-19 Eli Zaretskii * xdisp.c (try_scrolling): Compute the limit for searching point diff -r 858e3e43cfd5 -r 9f55c53fc33a src/xdisp.c --- a/src/xdisp.c Sun Jun 20 00:55:14 2010 -0400 +++ b/src/xdisp.c Sun Jun 20 21:04:30 2010 +0300 @@ -13486,7 +13486,26 @@ return SCROLLING_FAILED; start_display (&it, w, startp); - move_it_vertically (&it, amount_to_scroll); + if (scroll_max < INT_MAX) + move_it_vertically (&it, amount_to_scroll); + else + { + /* Extra precision for users who set scroll-conservatively + to most-positive-fixnum: make sure the amount we scroll + the window start is never less than amount_to_scroll, + which was computed as distance from window bottom to + point. This matters when lines at window top and lines + below window bottom have different height. */ + struct it it1 = it; + /* We use a temporary it1 because line_bottom_y can modify + its argument, if it moves one line down; see there. */ + int start_y = line_bottom_y (&it1); + + do { + move_it_by_lines (&it, 1, 1); + it1 = it; + } while (line_bottom_y (&it1) - start_y < amount_to_scroll); + } /* If STARTP is unchanged, move it down another screen line. */ if (CHARPOS (it.current.pos) == CHARPOS (startp))