changeset 25316:561aa7ea85a7

(unwind_redisplay): New. Resets flag redisplaying_p. (redisplay_internal): Register unwind_redisplay with register_unwind_protect. (try_window_reusing_current_matrix): If new start > old start, give up if start pos of first reusable row is not equal to new start.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 17 Aug 1999 22:44:56 +0000
parents 79bb4978ab2e
children 06136c6979f1
files src/xdisp.c
diffstat 1 files changed, 25 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Tue Aug 17 22:44:47 1999 +0000
+++ b/src/xdisp.c	Tue Aug 17 22:44:56 1999 +0000
@@ -600,6 +600,7 @@
 
 /* Function prototypes.  */
 
+static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
 static int string_char_and_length P_ ((unsigned char *, int, int *));
 static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
 					     struct text_pos));
@@ -6355,6 +6356,7 @@
   int must_finish = 0;
   struct text_pos tlbufpos, tlendpos;
   int number_of_visible_frames;
+  int count;
 
   /* Non-zero means redisplay has to consider all windows on all
      frames.  Zero means, only selected_window is considered.  */
@@ -6385,10 +6387,16 @@
     return;
 #endif
 
+  /* I don't think this happens but let's be paranoid.  */
   if (redisplaying_p)
     return;
+
+  /* Record a function that resets redisplaying_p to its old value
+     when we leave this function.  */
+  count = specpdl_ptr - specpdl;
+  record_unwind_protect (unwind_redisplay, make_number (redisplaying_p));
   ++redisplaying_p;
-
+  
  retry:
 
   /* If new fonts have been loaded that make a glyph matrix adjustment
@@ -6976,8 +6984,7 @@
 
  end_of_redisplay:;
   
-  if (--redisplaying_p < 0)
-    redisplaying_p = 0;
+  unbind_to (count, Qnil);
 }
 
 
@@ -7009,6 +7016,18 @@
 }
 
 
+/* Function registered with record_unwind_protect in
+   redisplay_internal.  Clears the flag indicating that a redisplay is
+   in progress.  */
+
+static Lisp_Object
+unwind_redisplay (old_redisplaying_p)
+     Lisp_Object old_redisplaying_p;
+{
+  redisplaying_p = XFASTINT (old_redisplaying_p);
+}
+
+
 /* Mark the display of windows in the window tree rooted at WINDOW as
    accurate or inaccurate.  If FLAG is non-zero mark display of WINDOW
    as accurate.  If FLAG is zero arrange for WINDOW to be redisplayed
@@ -8701,14 +8720,11 @@
 
       /* Give up if there is no row to reuse.  */
       if (MATRIX_ROW_BOTTOM_Y (first_reusable_row) >= yb
-	  || !first_reusable_row->enabled_p)
+	  || !first_reusable_row->enabled_p
+	  || (MATRIX_ROW_START_CHARPOS (first_reusable_row)
+	      != CHARPOS (new_start)))
 	return 0;
 
-      /* The row we found must start at new_start, or else something
-	 is broken.  */
-      xassert (MATRIX_ROW_START_CHARPOS (first_reusable_row)
-	       == CHARPOS (new_start));
-      
       /* We can reuse fully visible rows beginning with
          first_reusable_row to the end of the window.  Set
          first_row_to_display to the first row that cannot be reused.