* src/window.c (window_scroll_pixel_based):
* src/xdisp.c (pos_visible_p): Don't allow simulated redisplay to
start outside the accessible portion of the buffer. This avoids
assertion violations when some Lisp narrows the buffer to less
than the current window, and then attempts to scroll the buffer.
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
SET_TEXT_POS_FROM_MARKER (top, 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 (top) > ZV)
+ our backs. Also, someone might narrow-to-region and immediately
+ call a scroll function. */
+ if (CHARPOS (top) > ZV || CHARPOS (top) < BEGV)
SET_TEXT_POS (top, BEGV, BEGV_BYTE);
/* If the top of the window is after CHARPOS, the latter is surely