summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/window.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c
index fb81e45cbc4..3f115260adf 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4149,12 +4149,13 @@ window_scroll_pixel_based (window, n, whole, noerror)
/* End if we end up at ZV or BEGV. */
if ((n > 0 && IT_CHARPOS (it) == ZV)
- || (n < 0 && IT_CHARPOS (it) == CHARPOS (start)))
+ || (n < 0 && IT_CHARPOS (it) == BEGV))
{
if (IT_CHARPOS (it) == ZV)
{
- if (it.current_y + it.max_ascent + it.max_descent
- > it.last_visible_y)
+ if (it.current_y < it.last_visible_y
+ && (it.current_y + it.max_ascent + it.max_descent
+ >= it.last_visible_y))
{
/* The last line was only partially visible, make it fully
visible. */