summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/window.c b/src/window.c
index 374ef0f838f..753ebc16fbf 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4813,8 +4813,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror)
SET_TEXT_POS_FROM_MARKER (start, w->start);
/* Scrolling a minibuffer window via scroll bar when the echo area
shows long text sometimes resets the minibuffer contents behind
- our backs. */
- if (CHARPOS (start) > ZV)
+ our backs. Also, someone might narrow-to-region and immediately
+ call a scroll function. */
+ if (CHARPOS (start) > ZV || CHARPOS (start) < BEGV)
SET_TEXT_POS (start, BEGV, BEGV_BYTE);
/* If PT is not visible in WINDOW, move back one half of