MOVE_NEWLINE_OR_CR
};
+/* This counter is used to clear the face cache every once in a while
+ in redisplay_internal. It is incremented for each redisplay.
+ Every CLEAR_FACE_CACHE_COUNT full redisplays, the face cache is
+ cleared. */
+
+#define CLEAR_FACE_CACHE_COUNT 500
+static int clear_face_cache_count;
+
+/* Record the previous terminal frame we displayed. */
+
+static struct frame *previous_terminal_frame;
+
+/* Non-zero while redisplay_internal is in progress. */
+
+int redisplaying_p;
+
+/* Non-zero while redisplay is updating the display. */
+
+int redisplay_updating_p;
\f
/* Function prototypes. */
/* If face attributes have been changed since the last redisplay,
free realized faces now because they depend on face definitions
- that might have changed. */
- if (face_change_count)
+ that might have changed. Don't free faces while there might be
+ desired matrices pending which reference these faces. */
+ if (face_change_count && !redisplay_updating_p)
{
face_change_count = 0;
free_all_realized_faces (Qnil);
#endif /* GLYPH_DEBUG */
-/* This counter is used to clear the face cache every once in a while
- in redisplay_internal. It is incremented for each redisplay.
- Every CLEAR_FACE_CACHE_COUNT full redisplays, the face cache is
- cleared. */
-
-#define CLEAR_FACE_CACHE_COUNT 500
-static int clear_face_cache_count;
-
-/* Record the previous terminal frame we displayed. */
-
-static struct frame *previous_terminal_frame;
-
-/* Non-zero while redisplay_internal is in progress. */
-
-int redisplaying_p;
-
-
/* Value is non-zero if all changes in window W, which displays
current_buffer, are in the text between START and END. START is a
buffer position, END is given as a distance from Z. Used in
retry:
pause = 0;
reconsider_clip_changes (w, current_buffer);
+ redisplay_updating_p = 0;
/* If new fonts have been loaded that make a glyph matrix adjustment
necessary, do it. */
/* Compare desired and current matrices, perform output. */
update:
-
+ redisplay_updating_p = 1;
+
/* If fonts changed, display again. */
if (fonts_changed_p)
goto retry;
if (windows_or_buffers_changed && !pause)
goto retry;
- end_of_redisplay:;
-
+ end_of_redisplay:
+ redisplay_updating_p = 0;
unbind_to (count, Qnil);
}