From: Eli Zaretskii Date: Mon, 11 Apr 2011 15:59:30 +0000 (+0300) Subject: Fix bug #8468 with redisplay when scroll-margin > 0. X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/11997c7643812a3a6f95da1c65c46d1c0307e2a7 Fix bug #8468 with redisplay when scroll-margin > 0. src/xdisp.c (redisplay_window): Don't try to determine the character position of the scroll margin if the window start point w->startp is outside the buffer's accessible region. --- diff --git a/src/ChangeLog b/src/ChangeLog index 6e9a169e8a..c164c6b5f5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-04-11 Eli Zaretskii + + * xdisp.c (redisplay_window): Don't try to determine the character + position of the scroll margin if the window start point w->startp + is outside the buffer's accessible region. + 2011-03-30 Eli Zaretskii * xdisp.c (syms_of_xdisp) : Document the diff --git a/src/xdisp.c b/src/xdisp.c index 9e331739cd..2b032bd659 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14248,7 +14248,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* If there is a scroll margin at the top of the window, find its character position. */ - if (margin) + if (margin + /* Cannot call start_display if startp is not in the + accessible region of the buffer. This can happen when we + have just switched to a different buffer and/or changed + its restriction. In that case, startp is initialized to + the character position 1 (BEG) because we did not yet + have chance to display the buffer even once. */ + && BEGV <= CHARPOS (startp) && CHARPOS (startp) <= ZV) { struct it it1;