From d1da8e534db54bb82b6f2b16bba86a6d202ac675 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 Sep 2017 17:20:47 +0300 Subject: [PATCH] Avoid infloop when scrolling under scroll-preserve-screen-position * src/window.c (window_scroll_pixel_based): If screen position is to be preserved, make sure its recorded Y coordinate is outside the scroll margin. (Bug#28342) --- src/window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/window.c b/src/window.c index 857870591f3..18adb62538b 100644 --- a/src/window.c +++ b/src/window.c @@ -5335,6 +5335,11 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) break; } SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); + /* Fix up the Y position to preserve, if it is inside the + scroll margin at the window top. */ + if (window_scroll_pixel_based_preserve_y >= 0 + && window_scroll_pixel_based_preserve_y < this_scroll_margin) + window_scroll_pixel_based_preserve_y = this_scroll_margin; } } else if (n < 0) -- 2.11.4.GIT