From 3b2c5ab1f0714b26e760a4816eb1c24eefdddbd2 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 27 Mar 2011 00:05:30 +0200 Subject: [PATCH] Fix scrolling with scroll-*-aggressively. Aggressive scrolling backward by large distance still doesn't DTRT. src/xdisp.c (try_scrolling): When aggressive scrolling is in use, don't let point enter the opposite scroll margin as result of the scroll. (redisplay_window): Fix operator precedence in condition. --- src/ChangeLog | 3 +++ src/xdisp.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index ef3a1546913..d4301c482e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,9 @@ (redisplay_window): Even when falling back on "recentering", position point in the window according to scroll-conservatively, scroll-margin, and scroll-*-aggressively variables. (Bug#6671) + (try_scrolling): When aggressive scrolling is in use, don't let + point enter the opposite scroll margin as result of the scroll. + (redisplay_window): Fix operator precedence in condition. 2011-03-26 Juanma Barranquero diff --git a/src/xdisp.c b/src/xdisp.c index 263bedec4a2..230e2fa1864 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13125,6 +13125,10 @@ try_scrolling (Lisp_Object window, int just_this_one_p, amount_to_scroll = float_amount; if (amount_to_scroll == 0 && float_amount > 0) amount_to_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; } } @@ -13208,6 +13212,11 @@ try_scrolling (Lisp_Object window, int just_this_one_p, amount_to_scroll = float_amount; if (amount_to_scroll == 0 && float_amount > 0) amount_to_scroll = 1; + amount_to_scroll -= this_scroll_margin - dy; + /* 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; } } @@ -14236,7 +14245,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) : BVAR (current_buffer, scroll_down_aggressively); if (!MINI_WINDOW_P (w) - && scroll_conservatively > SCROLL_LIMIT || NUMBERP (aggressive)) + && (scroll_conservatively > SCROLL_LIMIT || NUMBERP (aggressive))) { int pt_offset = 0; -- 2.11.4.GIT