emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110795: Fix bug #12811 with scrol


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r110795: Fix bug #12811 with scrolling under scroll-up/down-aggressively.
Date: Tue, 06 Nov 2012 18:36:02 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110795
fixes bug: http://debbugs.gnu.org/12811
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2012-11-06 18:36:02 +0200
message:
  Fix bug #12811 with scrolling under scroll-up/down-aggressively.
  
   src/xdisp.c (try_scrolling): Fix correction of aggressive-scroll
   amount when the scroll margins are too large.  When scrolling
   backwards in the buffer, give up if cannot reach point or the
   scroll margin within a reasonable number of screen lines.  Fixes
   point position in window under scroll-up/down-aggressively when
   point is positioned many lines beyond the window top/bottom.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-11-05 17:23:25 +0000
+++ b/src/ChangeLog     2012-11-06 16:36:02 +0000
@@ -1,3 +1,13 @@
+2012-11-06  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (try_scrolling): Fix correction of aggressive-scroll
+       amount when the scroll margins are too large.  When scrolling
+       backwards in the buffer, give up if cannot reach point or the
+       scroll margin within a reasonable number of screen lines.  Fixes
+       point position in window under scroll-up/down-aggressively when
+       point is positioned many lines beyond the window top/bottom.
+       (Bug#12811)
+
 2012-11-05  Eli Zaretskii  <address@hidden>
 
        * ralloc.c (relinquish): If real_morecore fails to return memory

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-11-03 09:25:34 +0000
+++ b/src/xdisp.c       2012-11-06 16:36:02 +0000
@@ -14791,13 +14791,18 @@
          if (NUMBERP (aggressive))
            {
              double float_amount = XFLOATINT (aggressive) * height;
-             amount_to_scroll = float_amount;
-             if (amount_to_scroll == 0 && float_amount > 0)
-               amount_to_scroll = 1;
+             int aggressive_scroll = float_amount;
+             if (aggressive_scroll == 0 && float_amount > 0)
+               aggressive_scroll = 1;
              /* Don't let point enter the scroll margin near top of
-                the window.  */
-             if (amount_to_scroll > height - 2*this_scroll_margin + dy)
-               amount_to_scroll = height - 2*this_scroll_margin + dy;
+                the window.  This could happen if the value of
+                scroll_up_aggressively is too large and there are
+                non-zero margins, because scroll_up_aggressively
+                means put point that fraction of window height
+                _from_the_bottom_margin_.  */
+             if (aggressive_scroll + 2*this_scroll_margin > height)
+               aggressive_scroll = height - 2*this_scroll_margin;
+             amount_to_scroll = dy + aggressive_scroll;
            }
        }
 
@@ -14857,7 +14862,8 @@
          /* Compute the vertical distance from PT to the scroll
             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.  */
+            Give up if distance is greater than scroll_max or if we
+            didn't reach the scroll margin position.  */
          SET_TEXT_POS (pos, PT, PT_BYTE);
          start_display (&it, w, pos);
          y0 = it.current_y;
@@ -14867,7 +14873,8 @@
                      y_to_move, -1,
                      MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
          dy = it.current_y - y0;
-         if (dy > scroll_max)
+         if (dy > scroll_max
+             || IT_CHARPOS (it) < CHARPOS (scroll_margin_pos))
            return SCROLLING_FAILED;
 
          /* Compute new window start.  */
@@ -14885,15 +14892,16 @@
              if (NUMBERP (aggressive))
                {
                  double float_amount = XFLOATINT (aggressive) * height;
-                 amount_to_scroll = float_amount;
-                 if (amount_to_scroll == 0 && float_amount > 0)
-                   amount_to_scroll = 1;
-                 amount_to_scroll -=
-                   this_scroll_margin - dy - FRAME_LINE_HEIGHT (f);
+                 int aggressive_scroll = float_amount;
+                 if (aggressive_scroll == 0 && float_amount > 0)
+                   aggressive_scroll = 1;
                  /* Don't let point enter the scroll margin near
-                    bottom of the window.  */
-                 if (amount_to_scroll > height - 2*this_scroll_margin + dy)
-                   amount_to_scroll = height - 2*this_scroll_margin + dy;
+                    bottom of the window, if the value of
+                    scroll_down_aggressively happens to be too
+                    large.  */
+                 if (aggressive_scroll + 2*this_scroll_margin > height)
+                   aggressive_scroll = height - 2*this_scroll_margin;
+                 amount_to_scroll = dy + aggressive_scroll;
                }
            }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]