aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2011-03-27 22:01:46 +0200
committerEli Zaretskii2011-03-27 22:01:46 +0200
commitfd738ca513341c0949c11af1c9add77529aeb63e (patch)
treec8cd9a412c26c36939b7559d658d38a68ab99aae /src
parent3b2c5ab1f0714b26e760a4816eb1c24eefdddbd2 (diff)
downloademacs-fd738ca513341c0949c11af1c9add77529aeb63e.tar.gz
emacs-fd738ca513341c0949c11af1c9add77529aeb63e.zip
Fix scrolling back with scroll-down-aggressively.
src/xdisp.c (try_scrolling): Clean up the case of PT below the margin at bottom of window: scroll_max can no longer be INT_MAX. (redisplay_window): Find character position of margin and use that, rather than adding margin to PT.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xdisp.c30
2 files changed, 28 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d4301c482e9..e7a93ab7819 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12011-03-27 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (try_scrolling): Clean up the case of PT below the
4 margin at bottom of window: scroll_max can no longer be INT_MAX.
5 (redisplay_window): Find character position of margin and use
6 that, rather than adding margin to PT.
7
12011-03-26 Eli Zaretskii <eliz@gnu.org> 82011-03-26 Eli Zaretskii <eliz@gnu.org>
2 9
3 * xdisp.c (redisplay_window): Don't check buffer's clip_changed 10 * xdisp.c (redisplay_window): Don't check buffer's clip_changed
diff --git a/src/xdisp.c b/src/xdisp.c
index 230e2fa1864..1b72f2e3081 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13083,10 +13083,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13083 always finds PT if scroll_conservatively is set to a large 13083 always finds PT if scroll_conservatively is set to a large
13084 number, such as most-positive-fixnum. */ 13084 number, such as most-positive-fixnum. */
13085 int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f)); 13085 int slack = max (scroll_max, 10 * FRAME_LINE_HEIGHT (f));
13086 int y_to_move = 13086 int y_to_move = it.last_visible_y + slack;
13087 slack >= INT_MAX - it.last_visible_y
13088 ? INT_MAX
13089 : it.last_visible_y + slack;
13090 13087
13091 /* Compute the distance from the scroll margin to PT or to 13088 /* Compute the distance from the scroll margin to PT or to
13092 the scroll limit, whichever comes first. This should 13089 the scroll limit, whichever comes first. This should
@@ -13198,8 +13195,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
13198 start_display (&it, w, startp); 13195 start_display (&it, w, startp);
13199 13196
13200 if (arg_scroll_conservatively) 13197 if (arg_scroll_conservatively)
13201 amount_to_scroll 13198 amount_to_scroll = max (dy, FRAME_LINE_HEIGHT (f) *
13202 = max (dy, FRAME_LINE_HEIGHT (f) * max (scroll_step, temp_scroll_step)); 13199 max (scroll_step, temp_scroll_step));
13203 else if (scroll_step || temp_scroll_step) 13200 else if (scroll_step || temp_scroll_step)
13204 amount_to_scroll = scroll_max; 13201 amount_to_scroll = scroll_max;
13205 else 13202 else
@@ -14238,8 +14235,22 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14238 scroll_margin > 0 14235 scroll_margin > 0
14239 ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4) 14236 ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4)
14240 : 0; 14237 : 0;
14241 int scrolling_up = PT > CHARPOS (startp) + margin; 14238 EMACS_INT margin_pos = CHARPOS (startp);
14242 Lisp_Object aggressive = 14239 int scrolling_up;
14240 Lisp_Object aggressive;
14241
14242 /* If there is a scroll margin at the top of the window, find
14243 its character position. */
14244 if (margin)
14245 {
14246 struct it it1;
14247
14248 start_display (&it1, w, startp);
14249 move_it_vertically (&it1, margin);
14250 margin_pos = IT_CHARPOS (it1);
14251 }
14252 scrolling_up = PT > margin_pos;
14253 aggressive =
14243 scrolling_up 14254 scrolling_up
14244 ? BVAR (current_buffer, scroll_up_aggressively) 14255 ? BVAR (current_buffer, scroll_up_aggressively)
14245 : BVAR (current_buffer, scroll_down_aggressively); 14256 : BVAR (current_buffer, scroll_down_aggressively);
@@ -14280,7 +14291,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14280 centering_position = margin * FRAME_LINE_HEIGHT (f) + pt_offset; 14291 centering_position = margin * FRAME_LINE_HEIGHT (f) + pt_offset;
14281 } 14292 }
14282 else 14293 else
14283 /* Move backward from point half the height of the window. */ 14294 /* Set the window start half the height of the window backward
14295 from point. */
14284 centering_position = window_box_height (w) / 2; 14296 centering_position = window_box_height (w) / 2;
14285 } 14297 }
14286 move_it_vertically_backward (&it, centering_position); 14298 move_it_vertically_backward (&it, centering_position);