Avoid assertion violation when scrolling minibuffer windows.
[bpt/emacs.git] / src / window.c
index af7968f..f93f58f 100644 (file)
@@ -4221,6 +4221,11 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
   void *itdata = NULL;
 
   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)
+    SET_TEXT_POS (start, BEGV, BEGV_BYTE);
 
   /* If PT is not visible in WINDOW, move back one half of
      the screen.  Allow PT to be partially visible, otherwise