changeset 25345:ca828f89fd6e

(do_pending_window_change): Add parameter `safe'. (change_frame_size): Ditto. (change_frame_size_1): Ditto. Deley size changes if redisplaying and not called from a safe place. (window_change_signal): Call change_frame_size with new parameter. (set_window_cursor_after_update): Do the cursor_in_echo_area case only for a mini-window showing a message. Don't let cursor end up after the end of a row. (adjust_frame_message_buffer): Removed references to echo_area_glyphs and previous_echo_glyphs. (direct_output_for_insert): Check for mini-window displaying echo area message differently. (update_frame): Likewise. (set_window_cursor_after_update): Likewise. In echo area, don't try to set cursor on rows that aren't enabled.
author Gerd Moellmann <gerd@gnu.org>
date Sat, 21 Aug 1999 19:29:02 +0000
parents 98eb0a0280e7
children 15ec35852b48
files src/dispnew.c
diffstat 1 files changed, 41 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Sat Aug 21 19:28:58 1999 +0000
+++ b/src/dispnew.c	Sat Aug 21 19:29:02 1999 +0000
@@ -126,7 +126,7 @@
 static void free_glyph_matrix P_ ((struct glyph_matrix *));
 static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
 				     int, int, struct dim));
-static void change_frame_size_1 P_ ((struct frame *, int, int, int, int));
+static void change_frame_size_1 P_ ((struct frame *, int, int, int, int, int));
 static void swap_glyphs_in_rows P_ ((struct glyph_row *, struct glyph_row *));
 static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *));
 static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *));
@@ -155,8 +155,10 @@
 			      int));
 static void mirror_make_current P_ ((struct window *, int));
 void check_window_matrix_pointers P_ ((struct window *));
+#if GLYPH_DEBUG
 static void check_matrix_pointers P_ ((struct glyph_matrix *,
 				       struct glyph_matrix *));
+#endif
 static void mirror_line_dance P_ ((struct window *, int, int, int *, char *));
 static int update_window_tree P_ ((struct window *, int));
 static int update_window P_ ((struct window *, int));
@@ -2096,10 +2098,6 @@
 
 /* Adjust/ allocate message buffer of frame F. 
 
-   The global variables echo_area_glyphs and previous_echo_area_glyphs
-   may be pointing to the frames message buffer and must be relocated
-   if the buffer is reallocated.
-
    Note that the message buffer is never freed.  Since I could not
    find a free in 19.34, I assume that freeing it would be
    problematic in some way and don't do it either.
@@ -2117,12 +2115,6 @@
     {
       char *buffer = FRAME_MESSAGE_BUF (f);
       char *new_buffer = (char *) xrealloc (buffer, size);
- 
-      if (buffer == echo_area_glyphs)
-        echo_area_glyphs = new_buffer;
-      if (buffer == previous_echo_glyphs)
-        previous_echo_glyphs = new_buffer;
-
       FRAME_MESSAGE_BUF (f) = new_buffer;
     }
   else
@@ -3028,8 +3020,7 @@
       /* Give up if buffer appears in two places.  */
       || buffer_shared > 1
       /* Give up if w is mini-buffer and a message is being displayed there */
-      || (MINI_WINDOW_P (w)
-	  && (echo_area_glyphs || STRINGP (echo_area_message)))
+      || (MINI_WINDOW_P (w) && !NILP (echo_area_buffer[0]))
       /* Give up for hscrolled mini-buffer because display of the prompt
 	 is handled specially there (see display_line).  */
       || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
@@ -3586,12 +3577,14 @@
      struct window *w;
      int force_p;
 {
-  struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   int paused_p;
   int preempt_count = baud_rate / 2400 + 1;
   extern int input_pending;
+#if GLYPH_DEBUG
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
   extern struct frame *updating_frame;
+#endif
 
   /* Check that W's frame doesn't have glyph matrices.  */
   xassert (FRAME_WINDOW_P (f));
@@ -4019,13 +4012,12 @@
   /* Not intended for frame matrix updates.  */
   xassert (FRAME_WINDOW_P (f));
   
-  if ((cursor_in_echo_area
-       /* If we are showing a message instead of the mini-buffer,
-	  show the cursor for the message instead of for the
-	  (now hidden) mini-buffer contents.  */
-       || (XWINDOW (minibuf_window) == w
-	   && EQ (minibuf_window, echo_area_window)
-	   && (echo_area_glyphs || STRINGP (echo_area_message))))
+  if (cursor_in_echo_area
+      && !NILP (echo_area_buffer[0])
+      /* If we are showing a message instead of the mini-buffer,
+	 show the cursor for the message instead.  */
+      && XWINDOW (minibuf_window) == w
+      && EQ (minibuf_window, echo_area_window)
       /* These cases apply only to the frame that contains
 	 the active mini-buffer window.  */
       && FRAME_HAS_MINIBUF_P (f)
@@ -4044,7 +4036,9 @@
 	  int yb = window_text_bottom_y (w);
 
 	  last_row = NULL;
-	  for (row = MATRIX_ROW (w->current_matrix, 0);; ++row)
+	  for (row = MATRIX_ROW (w->current_matrix, 0);
+	       row->enabled_p;
+	       ++row)
 	    {
 	      if (row->used[TEXT_AREA]
 		  && row->glyphs[TEXT_AREA][0].charpos >= 0)
@@ -4057,9 +4051,9 @@
 	  if (last_row)
 	    {
 	      struct glyph *start = row->glyphs[TEXT_AREA];
-	      struct glyph *last = start + row->used[TEXT_AREA];
-
-	      while (last > start && (last - 1)->charpos < 0)
+	      struct glyph *last = start + row->used[TEXT_AREA] - 1;
+
+	      while (last > start && last->charpos < 0)
 		--last;
 	      
 	      for (glyph = start; glyph < last; ++glyph)
@@ -4529,7 +4523,7 @@
 	      (now hidden) mini-buffer contents.  */
 	   || (EQ (minibuf_window, selected_window)
 	       && EQ (minibuf_window, echo_area_window)
-	       && (echo_area_glyphs || STRINGP (echo_area_message))))
+	       && !NILP (echo_area_buffer[0])))
 	  /* These cases apply only to the frame that contains
 	     the active mini-buffer window.  */
 	  && FRAME_HAS_MINIBUF_P (f)
@@ -4561,7 +4555,6 @@
 		    {
 		      /* Frame rows are filled up with spaces that
 			 must be ignored here.  */
-		      int i;
 		      struct glyph_row *r = MATRIX_ROW (current_matrix,
 							row);
 		      struct glyph *start = r->glyphs[TEXT_AREA];
@@ -5186,7 +5179,7 @@
       {
 	if (FRAME_TERMCAP_P (XFRAME (frame)))
 	  {
-	    change_frame_size (XFRAME (frame), height, width, 0, 1);
+	    change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
 	    break;
 	  }
       }
@@ -5198,12 +5191,18 @@
 #endif /* SIGWINCH */
 
 
-/* Do any change in frame size that was requested by a signal.  */
+/* Do any change in frame size that was requested by a signal.  SAFE
+   non-zero means this function is called from a place where it is
+   safe to change frame sizes  while a redisplay is in progress.  */
 
 void
-do_pending_window_change ()
+do_pending_window_change (safe)
+     int safe;
 {
   /* If window_change_signal should have run before, run it now.  */
+  if (redisplaying_p && !safe)
+    return;
+  
   while (delayed_size_change)
     {
       Lisp_Object tail, frame;
@@ -5218,7 +5217,7 @@
 	  int width = FRAME_NEW_WIDTH (f);
 
 	  if (height != 0 || width != 0)
-	    change_frame_size (f, height, width, 0, 0);
+	    change_frame_size (f, height, width, 0, 0, safe);
 	}
     }
 }
@@ -5230,12 +5229,15 @@
    If DELAY is non-zero, then assume we're being called from a signal
    handler, and queue the change for later - perhaps the next
    redisplay.  Since this tries to resize windows, we can't call it
-   from a signal handler.  */
+   from a signal handler.
+
+   SAFE non-zero means this function is called from a place where it's
+   safe to change frame sizes while a redisplay is in progress.  */
 
 void
-change_frame_size (f, newheight, newwidth, pretend, delay)
+change_frame_size (f, newheight, newwidth, pretend, delay, safe)
      register struct frame *f;
-     int newheight, newwidth, pretend, delay;
+     int newheight, newwidth, pretend, delay, safe;
 {
   Lisp_Object tail, frame;
 
@@ -5246,23 +5248,22 @@
       FOR_EACH_FRAME (tail, frame)
 	if (! FRAME_WINDOW_P (XFRAME (frame)))
 	  change_frame_size_1 (XFRAME (frame), newheight, newwidth,
-			       pretend, delay);
+			       pretend, delay, safe);
     }
   else
-    change_frame_size_1 (f, newheight, newwidth, pretend, delay);
+    change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe);
 }
 
 static void
-change_frame_size_1 (f, newheight, newwidth, pretend, delay)
+change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
      register struct frame *f;
-     int newheight, newwidth, pretend, delay;
+     int newheight, newwidth, pretend, delay, safe;
 {
   int new_frame_window_width;
-  unsigned int total_glyphs;
   int count = specpdl_ptr - specpdl;
 
   /* If we can't deal with the change now, queue it for later.  */
-  if (delay)
+  if (delay || (redisplaying_p && !safe))
     {
       FRAME_NEW_HEIGHT (f) = newheight;
       FRAME_NEW_WIDTH (f) = newwidth;