emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 47ddaaab02: Fix infloop in 'redisplay_window' when buffer is narr


From: Eli Zaretskii
Subject: master 47ddaaab02: Fix infloop in 'redisplay_window' when buffer is narrowed
Date: Sun, 6 Feb 2022 05:28:05 -0500 (EST)

branch: master
commit 47ddaaab02b1011c6028442c9df0676393de9e99
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix infloop in 'redisplay_window' when buffer is narrowed
    
    * src/xdisp.c (redisplay_window): Ensure window-start point is in
    the accessible portion of the buffer when passing it to
    'window_start_acceptable_p'.  (Bug#14582)
---
 src/xdisp.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index db9bc512a9..cafc50e755 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18754,9 +18754,8 @@ window_start_acceptable_p (Lisp_Object window, 
ptrdiff_t startp)
   struct text_pos ignored;
 
   /* Is STARTP in invisible text?  */
-  if (startp > BEGV
-      && ((invprop = Fget_char_property (startpos, Qinvisible, window)),
-         TEXT_PROP_MEANS_INVISIBLE (invprop) != 0))
+  if ((invprop = Fget_char_property (startpos, Qinvisible, window)),
+      TEXT_PROP_MEANS_INVISIBLE (invprop) != 0)
     return false;
 
   /* Is STARTP covered by a replacing 'display' property?  */
@@ -19285,10 +19284,12 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
   /* If current starting point was originally the beginning of a line
      but no longer is, or if the starting point is invisible but the
      buffer wants it always visible, find a new starting point.  */
-  else if ((w->start_at_line_beg
-           && !(CHARPOS (startp) <= BEGV
-                || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n'))
-          || !window_start_acceptable_p (window, CHARPOS (startp)))
+  else if (w->start_at_line_beg
+          && ((CHARPOS (startp) > BEGV
+               && FETCH_BYTE (BYTEPOS (startp) - 1) != '\n')
+              || (CHARPOS (startp) >= BEGV
+                  && CHARPOS (startp) <= ZV
+                  && !window_start_acceptable_p (window, CHARPOS (startp)))))
     {
 #ifdef GLYPH_DEBUG
       debug_method_add (w, "recenter 1");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]