]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid recentering when lines differ in their height.
authorEli Zaretskii <eliz@gnu.org>
Sun, 20 Jun 2010 18:04:30 +0000 (21:04 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 20 Jun 2010 18:04:30 +0000 (21:04 +0300)
 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.

src/ChangeLog
src/xdisp.c

index 7d875bf5bdaca7063a2b9de2f426bbf457a317e2..7405d92e0e68a2473518ec55dbeea53c4defd46e 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * 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  <eliz@gnu.org>
 
        * xdisp.c (try_scrolling): Compute the limit for searching point
index d533346c3b629745d4653447db8abb8a5569cbb7..795e13e6f1a687afd14f39562b0e68c1ee503827 100644 (file)
@@ -13486,7 +13486,26 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
        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))