aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorEli Zaretskii2016-09-05 19:57:22 +0300
committerEli Zaretskii2016-09-05 19:57:22 +0300
commit6acff25280dbb97b5e9ddfd872b33ceb36b0470a (patch)
tree24b7152457c11d14aefdf8952ce7d3500586be05 /src/window.c
parentcfaf18a27c262694750400005e882f1cfc7ff2b0 (diff)
downloademacs-6acff25280dbb97b5e9ddfd872b33ceb36b0470a.tar.gz
emacs-6acff25280dbb97b5e9ddfd872b33ceb36b0470a.zip
Avoid assertion violations when scrolling narrowed buffer
* 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.
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)
4813 SET_TEXT_POS_FROM_MARKER (start, w->start); 4813 SET_TEXT_POS_FROM_MARKER (start, w->start);
4814 /* Scrolling a minibuffer window via scroll bar when the echo area 4814 /* Scrolling a minibuffer window via scroll bar when the echo area
4815 shows long text sometimes resets the minibuffer contents behind 4815 shows long text sometimes resets the minibuffer contents behind
4816 our backs. */ 4816 our backs. Also, someone might narrow-to-region and immediately
4817 if (CHARPOS (start) > ZV) 4817 call a scroll function. */
4818 if (CHARPOS (start) > ZV || CHARPOS (start) < BEGV)
4818 SET_TEXT_POS (start, BEGV, BEGV_BYTE); 4819 SET_TEXT_POS (start, BEGV, BEGV_BYTE);
4819 4820
4820 /* If PT is not visible in WINDOW, move back one half of 4821 /* If PT is not visible in WINDOW, move back one half of