]> code.delx.au - gnu-emacs/blobdiff - src/dispnew.c
(adjust_glyph_matrix, enable_glyph_matrix_rows):
[gnu-emacs] / src / dispnew.c
index c0176a59abc8ac806033bbebdf99be6583f2d57b..b20383dcfa91920c74ccb9937a4cade2f251092f 100644 (file)
@@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA.  */
 #include "cm.h"
 #include "buffer.h"
 #include "charset.h"
+#include "keyboard.h"
 #include "frame.h"
 #include "window.h"
 #include "commands.h"
@@ -45,7 +46,6 @@ Boston, MA 02111-1307, USA.  */
 #include "intervals.h"
 #include "blockinput.h"
 #include "process.h"
-#include "keyboard.h"
 
 /* I don't know why DEC Alpha OSF1 fail to compile this file if we
    include the following file.  */
@@ -135,7 +135,9 @@ 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, int));
 static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *));
+#ifdef GLYPH_DEBUG
 static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *));
+#endif
 static void fill_up_frame_row_with_spaces P_ ((struct glyph_row *, int));
 static void build_frame_matrix_from_window_tree P_ ((struct glyph_matrix *,
                                                     struct window *));
@@ -154,7 +156,7 @@ void scroll_glyph_matrix_range P_ ((struct glyph_matrix *, int, int,
 static void clear_window_matrices P_ ((struct window *, int));
 static void fill_up_glyph_row_area_with_spaces P_ ((struct glyph_row *, int));
 static int scrolling_window P_ ((struct window *, int));
-static int update_window_line P_ ((struct window *, int));
+static int update_window_line P_ ((struct window *, int, int *));
 static void update_marginal_area P_ ((struct window *, int, int));
 static int update_text_area P_ ((struct window *, int));
 static void make_current P_ ((struct glyph_matrix *, struct glyph_matrix *,
@@ -171,7 +173,7 @@ static int update_window P_ ((struct window *, int));
 static int update_frame_1 P_ ((struct frame *, int, int));
 static void set_window_cursor_after_update P_ ((struct window *));
 static int row_equal_p P_ ((struct window *, struct glyph_row *,
-                           struct glyph_row *));
+                           struct glyph_row *, int));
 static void adjust_frame_glyphs_for_window_redisplay P_ ((struct frame *));
 static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *));
 static void reverse_rows P_ ((struct glyph_matrix *, int, int));
@@ -239,7 +241,7 @@ Lisp_Object Vstandard_display_table;
 
 int cursor_in_echo_area;
 
-Lisp_Object Qdisplay_table;
+Lisp_Object Qdisplay_table, Qredisplay_dont_pause;
 
 \f
 /* The currently selected frame.  In a single-frame version, this
@@ -665,6 +667,7 @@ adjust_glyph_matrix (w, matrix, x, y, dim)
   
   /* Number of rows to be used by MATRIX.  */
   matrix->nrows = dim.height;
+  xassert (matrix->nrows >= 0);
 
   /* Mark rows in a current matrix of a window as not having valid
      contents.  It's important to not do this for desired matrices.
@@ -990,6 +993,16 @@ clear_glyph_row (row)
   row->glyphs[TEXT_AREA] = p[TEXT_AREA];
   row->glyphs[RIGHT_MARGIN_AREA] = p[RIGHT_MARGIN_AREA];
   row->glyphs[LAST_AREA] = p[LAST_AREA];
+
+#if 0 /* At some point, some bit-fields of struct glyph were not set,
+        which made glyphs unequal when compared with GLYPH_EQUAL_P.
+        Redisplay outputs such glyphs, and flickering effects were
+        the result.  This also depended on the contents of memory
+        returned by xmalloc.  If flickering happens again, activate
+        the code below If the flickering is gone with that, chances
+        are that the flickering has the same reason as here.  */
+  bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]);
+#endif
 }
 
 
@@ -1180,6 +1193,8 @@ assign_row (to, from)
    is non-zero if the glyph memory of WINDOW_ROW is part of the glyph
    memory of FRAME_ROW.  */
 
+#ifdef GLYPH_DEBUG
+
 static int
 glyph_row_slice_p (window_row, frame_row)
      struct glyph_row *window_row, *frame_row;
@@ -1192,6 +1207,7 @@ glyph_row_slice_p (window_row, frame_row)
          && window_glyph_start < frame_glyph_end);
 }
 
+#endif /* GLYPH_DEBUG */
 
 #if 0
 
@@ -1338,12 +1354,14 @@ line_draw_cost (matrix, vpos)
 /* Test two glyph rows A and B for equality.  Value is non-zero if A
    and B have equal contents.  W is the window to which the glyphs
    rows A and B belong.  It is needed here to test for partial row
-   visibility.  */
+   visibility.  MOUSE_FACE_P non-zero means compare the mouse_face_p
+   flags of A and B, too.  */
 
 static INLINE int 
-row_equal_p (w, a, b)
+row_equal_p (w, a, b, mouse_face_p)
      struct window *w;
      struct glyph_row *a, *b;
+     int mouse_face_p;
 {
   if (a == b)
     return 1;
@@ -1354,6 +1372,9 @@ row_equal_p (w, a, b)
       struct glyph *a_glyph, *b_glyph, *a_end;
       int area;
 
+      if (mouse_face_p && a->mouse_face_p != b->mouse_face_p)
+       return 0;
+
       /* Compare glyphs.  */
       for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
        {
@@ -2434,6 +2455,7 @@ build_frame_matrix_from_leaf_window (frame_matrix, w)
     {
       struct glyph_row *frame_row = frame_matrix->rows + frame_y;
       struct glyph_row *window_row = window_matrix->rows + window_y;
+      int current_row_p = window_matrix == w->current_matrix;
 
       /* Fill up the frame row with spaces up to the left margin of the
         window row.  */
@@ -2441,19 +2463,32 @@ build_frame_matrix_from_leaf_window (frame_matrix, w)
 
       /* Fill up areas in the window matrix row with spaces.  */
       fill_up_glyph_row_with_spaces (window_row);
+
+      /* If only part of W's desired matrix has been built, and
+         window_row wasn't displayed, use the corresponding current
+         row instead.  */
+      if (window_matrix == w->desired_matrix
+         && !window_row->enabled_p)
+       {
+         window_row = w->current_matrix->rows + window_y;
+         current_row_p = 1;
+       }
       
-      if (window_matrix == w->current_matrix)
+      if (current_row_p)
        {
-         /* We have to copy W's current matrix.  Copy window
-            row to frame row.  */
+         /* Copy window row to frame row.  */
          bcopy (window_row->glyphs[0],
                 frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
                 window_matrix->matrix_w * sizeof (struct glyph));
        }
       else
        {
-         /* Copy W's desired matrix.  */
-
+         xassert (window_row->enabled_p);
+         
+         /* Only when a desired row has been displayed, we want
+            the corresponding frame row to be updated.  */
+         frame_row->enabled_p = 1;
+         
           /* Maybe insert a vertical border between horizontally adjacent
             windows.  */
           if (right_border_glyph)
@@ -2503,8 +2538,7 @@ build_frame_matrix_from_leaf_window (frame_matrix, w)
       frame_row->used[TEXT_AREA] 
        = window_matrix->matrix_x + window_matrix->matrix_w;
 
-      /* Or in flags.  */
-      frame_row->enabled_p |= window_row->enabled_p;
+      /* Or in other flags.  */
       frame_row->inverse_p |= window_row->inverse_p;
 
       /* Next row.  */
@@ -2610,6 +2644,7 @@ make_current (desired_matrix, current_matrix, row)
 {
   struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
   struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
+  int mouse_face_p = current_row->mouse_face_p;
 
   /* Do current_row = desired_row.  This exchanges glyph pointers
      between both rows, and does a structure assignment otherwise.  */
@@ -2617,6 +2652,7 @@ make_current (desired_matrix, current_matrix, row)
 
   /* Enable current_row to mark it as valid.  */
   current_row->enabled_p = 1;
+  current_row->mouse_face_p = mouse_face_p;
 
   /* If we are called on frame matrices, perform analogous operations
      for window matrices.  */
@@ -3172,6 +3208,8 @@ direct_output_for_insert (g)
                 DEFAULT_FACE_ID);
 
   glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+  if (glyph_row->mouse_face_p)
+    return 0;
   
   /* Give up if highlighting trailing whitespace and we have trailing
      whitespace in glyph_row.  We would have to remove the trailing
@@ -3345,7 +3383,7 @@ direct_output_for_insert (g)
     }
 
   if (rif)
-    rif->update_window_end_hook (w, 1);
+    rif->update_window_end_hook (w, 1, 0);
   update_end (f);
   updated_row = NULL;
   fflush (stdout);
@@ -3407,17 +3445,25 @@ direct_output_forward_char (n)
   if (!NILP (echo_area_buffer[0]) || !NILP (echo_area_buffer[1]))
     return 0;
 
+  /* Give up if currently displaying a message instead of the
+     minibuffer contents.  */
+  if (XWINDOW (minibuf_window) == w
+      && EQ (minibuf_window, echo_area_window))
+    return 0;
+  
   /* Give up if we don't know where the cursor is.  */
   if (w->cursor.vpos < 0)
     return 0;
 
   row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
 
+  /* Give up if PT is outside of the last known cursor row.  */
   if (PT <= MATRIX_ROW_START_BYTEPOS (row)
       || PT >= MATRIX_ROW_END_BYTEPOS (row))
     return 0;
 
   set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
+  
   w->last_cursor = w->cursor;
   XSETFASTINT (w->last_point, PT);
 
@@ -3515,10 +3561,9 @@ update_frame (f, force_p, inhibit_hairy_id_p)
       /* Update windows.  */
       paused_p = update_window_tree (root_window, force_p);
       update_end (f);
-      display_completed = !paused_p;
-
-      /* The flush is a performance bottleneck under X.  */
-#if 0
+      
+#if 0 /* This flush is a performance bottleneck under X,
+        and it doesn't seem to be necessary anyway.  */
       rif->flush_display (f);
 #endif
     }
@@ -3528,21 +3573,26 @@ update_frame (f, force_p, inhibit_hairy_id_p)
         frame matrix we operate.  */
       set_frame_matrix_frame (f);
 
-      /* Build F's desired matrix from window matrices.  For windows
-        whose must_be_updated_p flag is set, desired matrices are
-        made part of the desired frame matrix.  For other windows,
-        the current matrix is copied.  */
+      /* Build F's desired matrix from window matrices.  */
       build_frame_matrix (f);
       
-      /* Do the update on the frame desired matrix.  */
+      /* Update the display  */
+      update_begin (f);
       paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
-      
+      update_end (f);
+
+      if (termscript)
+       fflush (termscript);
+      fflush (stdout);
+
       /* Check window matrices for lost pointers.  */
       IF_DEBUG (check_window_matrix_pointers (root_window));
     }
 
   /* Reset flags indicating that a window should be updated.  */
   set_window_update_flags (root_window, 0);
+  
+  display_completed = !paused_p;
   return paused_p;
 }
 
@@ -3612,8 +3662,7 @@ redraw_overlapped_rows (w, yb)
      struct window *w;
      int yb;
 {
-  int i, bottom_y;
-  struct glyph_row *row;
+  int i;
   
   /* If rows overlapping others have been changed, the rows being
      overlapped have to be redrawn.  This won't draw lines that have
@@ -3622,7 +3671,7 @@ redraw_overlapped_rows (w, yb)
      current rows is 0.  */
   for (i = 0; i < w->current_matrix->nrows; ++i)
     {
-      row = w->current_matrix->rows + i;
+      struct glyph_row *row = w->current_matrix->rows + i;
 
       if (!row->enabled_p)
        break;
@@ -3646,8 +3695,7 @@ redraw_overlapped_rows (w, yb)
          row->overlapped_p = 0;
        }
 
-      bottom_y = MATRIX_ROW_BOTTOM_Y (row);
-      if (bottom_y >= yb)
+      if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
        break;
     }
 }
@@ -3736,7 +3784,7 @@ update_window (w, force_p)
       struct glyph_row *row, *end;
       struct glyph_row *mode_line_row;
       struct glyph_row *header_line_row = NULL;
-      int yb, changed_p = 0;
+      int yb, changed_p = 0, mouse_face_overwritten_p = 0;
 
       rif->update_window_begin_hook (w);
       yb = window_text_bottom_y (w);
@@ -3754,7 +3802,8 @@ update_window (w, force_p)
        {
          mode_line_row->y = yb;
          update_window_line (w, MATRIX_ROW_VPOS (mode_line_row,
-                                                 desired_matrix));
+                                                 desired_matrix),
+                             &mouse_face_overwritten_p);
          changed_p = 1;
        }
 
@@ -3764,7 +3813,7 @@ update_window (w, force_p)
       while (row < end && !row->enabled_p)
        ++row;
       
-      /* Try reusing part of the display by inserting/deleting lines.  */
+      /* Try reusing part of the display by copying.  */
       if (row < end && !desired_matrix->no_scrolling_p)
        {
          int rc = scrolling_window (w, header_line_row != NULL);
@@ -3785,17 +3834,13 @@ update_window (w, force_p)
       if (header_line_row && header_line_row->enabled_p)
        {
          header_line_row->y = 0;
-         update_window_line (w, 0);
+         update_window_line (w, 0, &mouse_face_overwritten_p);
          changed_p = 1;
        }
 
       /* Update the rest of the lines.  */
       for (; row < end && (force_p || !input_pending); ++row)
-       if (row->enabled_p
-           /* A row can be completely invisible in case a desired
-              matrix was built with a vscroll and then
-              make_cursor_line_fully_visible shifts the matrix.  */
-           && row->visible_height > 0)
+       if (row->enabled_p)
          {
            int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
            int i;
@@ -3807,7 +3852,8 @@ update_window (w, force_p)
            if (!force_p && vpos % preempt_count == 0)
              detect_input_pending ();
 
-           changed_p |= update_window_line (w, vpos);
+           changed_p |= update_window_line (w, vpos,
+                                            &mouse_face_overwritten_p);
 
            /* Mark all rows below the last visible one in the current
               matrix as invalid.  This is necessary because of
@@ -3829,24 +3875,19 @@ update_window (w, force_p)
     set_cursor:
       
       /* Fix the appearance of overlapping(overlapped rows.  */
-      if (rif->fix_overlapping_area
-         && !w->pseudo_window_p
-         && changed_p
-         && !paused_p)
-       {
-         redraw_overlapped_rows (w, yb);
-         redraw_overlapping_rows (w, yb);
-       }
-      
       if (!paused_p && !w->pseudo_window_p)
        {
+         if (changed_p && rif->fix_overlapping_area)
+           {
+             redraw_overlapped_rows (w, yb);
+             redraw_overlapping_rows (w, yb);
+           }
+      
          /* Make cursor visible at cursor position of W.  */
          set_window_cursor_after_update (w);
 
-#if 0
-         /* Check that current matrix invariants are satisfied.  This
-            is for debugging only.  See the comment around
-            check_matrix_invariants.  */
+#if 0 /* Check that current matrix invariants are satisfied.  This is
+        for debugging only.  See the comment of check_matrix_invariants.  */
          IF_DEBUG (check_matrix_invariants (w));
 #endif
        }
@@ -3857,8 +3898,7 @@ update_window (w, force_p)
 #endif
 
       /* End of update of window W.  */
-      rif->update_window_end_hook (w, 1);
-
+      rif->update_window_end_hook (w, 1, mouse_face_overwritten_p);
     }
   else
     paused_p = 1;
@@ -3918,6 +3958,7 @@ update_text_area (w, vpos)
       || desired_row->phys_height != current_row->phys_height
       || desired_row->visible_height != current_row->visible_height
       || current_row->overlapped_p
+      || current_row->mouse_face_p
       || current_row->x != desired_row->x)
     {
       rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
@@ -4077,54 +4118,67 @@ update_text_area (w, vpos)
    changed.  */
 
 static int
-update_window_line (w, vpos)
+update_window_line (w, vpos, mouse_face_overwritten_p)
      struct window *w;
-     int vpos;
+     int vpos, *mouse_face_overwritten_p;
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
   int changed_p = 0;
 
-  xassert (desired_row->enabled_p);
-
   /* Set the row being updated.  This is important to let xterm.c
      know what line height values are in effect.  */
   updated_row = desired_row;
 
-  /* Update display of the left margin area, if there is one.  */
-  if (!desired_row->full_width_p
-      && !NILP (w->left_margin_width))
+  /* A row can be completely invisible in case a desired matrix was 
+     built with a vscroll and then make_cursor_line_fully_visible shifts 
+     the matrix.  Make sure to make such rows current anyway, since
+     we need the correct y-position, for example, in the current matrix.  */
+  if (desired_row->mode_line_p
+      || desired_row->visible_height > 0)
     {
-      update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
-      changed_p = 1;
-    }
-  
-  /* Update the display of the text area.  */
-  changed_p |= update_text_area (w, vpos);
-  
-  /* Update display of the right margin area, if there is one.  */
-  if (!desired_row->full_width_p
-      && !NILP (w->right_margin_width))
-    {
-      changed_p = 1;
-      update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
+      xassert (desired_row->enabled_p);
+
+      /* Update display of the left margin area, if there is one.  */
+      if (!desired_row->full_width_p
+         && !NILP (w->left_margin_width))
+       {
+         changed_p = 1;
+         update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
+       }
+      
+      /* Update the display of the text area.  */
+      if (update_text_area (w, vpos))
+       {
+         changed_p = 1;
+         if (current_row->mouse_face_p)
+           *mouse_face_overwritten_p = 1;
+       }
+      
+      /* Update display of the right margin area, if there is one.  */
+      if (!desired_row->full_width_p
+         && !NILP (w->right_margin_width))
+       {
+         changed_p = 1;
+         update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
+       }
+      
+      /* Draw truncation marks etc.  */
+      if (!current_row->enabled_p
+         || desired_row->y != current_row->y
+         || desired_row->visible_height != current_row->visible_height
+         || desired_row->overlay_arrow_p != current_row->overlay_arrow_p
+         || desired_row->truncated_on_left_p != current_row->truncated_on_left_p
+         || desired_row->truncated_on_right_p != current_row->truncated_on_right_p
+         || desired_row->continued_p != current_row->continued_p
+         || desired_row->mode_line_p != current_row->mode_line_p
+         || (desired_row->indicate_empty_line_p
+             != current_row->indicate_empty_line_p)
+         || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row)
+             != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
+       rif->after_update_window_line_hook (desired_row);
     }
   
-  /* Draw truncation marks etc.  */
-  if (!current_row->enabled_p
-      || desired_row->y != current_row->y
-      || desired_row->visible_height != current_row->visible_height
-      || desired_row->overlay_arrow_p != current_row->overlay_arrow_p
-      || desired_row->truncated_on_left_p != current_row->truncated_on_left_p
-      || desired_row->truncated_on_right_p != current_row->truncated_on_right_p
-      || desired_row->continued_p != current_row->continued_p
-      || desired_row->mode_line_p != current_row->mode_line_p
-      || (desired_row->indicate_empty_line_p
-         != current_row->indicate_empty_line_p)
-      || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row)
-         != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
-    rif->after_update_window_line_hook (desired_row);
-  
   /* Update current_row from desired_row.  */
   make_current (w->desired_matrix, w->current_matrix, vpos);
   updated_row = NULL;
@@ -4313,7 +4367,7 @@ add_row_entry (w, row)
   int i = row->hash % row_table_size;
   
   entry = row_table[i];
-  while (entry && !row_equal_p (w, entry->row, row))
+  while (entry && !row_equal_p (w, entry->row, row, 1))
     entry = entry->next;
   
   if (entry == NULL)
@@ -4370,20 +4424,23 @@ scrolling_window (w, header_line_p)
   struct row_entry *entry;
 
   /* Skip over rows equal at the start.  */
-  i = header_line_p ? 1 : 0;
-  while (i < current_matrix->nrows - 1
-         && MATRIX_ROW_ENABLED_P (current_matrix, i)
-        && MATRIX_ROW_ENABLED_P (desired_matrix, i)
-        && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i)) <= yb
-        && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (current_matrix, i)) <= yb
-         && row_equal_p (w,
-                        MATRIX_ROW (desired_matrix, i),
-                         MATRIX_ROW (current_matrix, i)))
+  for (i = header_line_p ? 1 : 0; i < current_matrix->nrows - 1; ++i)
     {
-      assign_row (MATRIX_ROW (current_matrix, i),
-                 MATRIX_ROW (desired_matrix, i));
-      MATRIX_ROW (desired_matrix, i)->enabled_p = 0;
-      ++i;
+      struct glyph_row *d = MATRIX_ROW (desired_matrix, i);
+      struct glyph_row *c = MATRIX_ROW (current_matrix, i);
+
+      if (c->enabled_p
+         && d->enabled_p
+         && c->y == d->y
+         && MATRIX_ROW_BOTTOM_Y (c) <= yb
+         && MATRIX_ROW_BOTTOM_Y (d) <= yb
+         && row_equal_p (w, c, d, 1))
+       {
+         assign_row (c, d);
+         d->enabled_p = 0;
+       }
+      else
+       break;
     }
 
   /* Give up if some rows in the desired matrix are not enabled.  */
@@ -4425,7 +4482,7 @@ scrolling_window (w, header_line_p)
             == MATRIX_ROW (desired_matrix, j - 1)->y)
          && row_equal_p (w,
                         MATRIX_ROW (desired_matrix, i - 1),
-                         MATRIX_ROW (current_matrix, j - 1)))
+                         MATRIX_ROW (current_matrix, j - 1), 1))
     --i, --j;
   last_new = i;
   last_old = j;
@@ -4611,10 +4668,10 @@ scrolling_window (w, header_line_p)
          {
            struct glyph_row *from, *to;
            int to_overlapped_p;
-           
+
            to = MATRIX_ROW (current_matrix, r->desired_vpos + j);
-           to_overlapped_p = to->overlapped_p;
            from = MATRIX_ROW (desired_matrix, r->desired_vpos + j);
+           to_overlapped_p = to->overlapped_p;
            assign_row (to, from);
            to->enabled_p = 1, from->enabled_p = 0;
            to->overlapped_p = to_overlapped_p;
@@ -4665,15 +4722,14 @@ update_frame_1 (f, force_p, inhibit_id_p)
   if (preempt_count <= 0)
     preempt_count = 1;
 
-  detect_input_pending ();
-  if (input_pending && !force_p)
+  if (redisplay_dont_pause)
+    force_p = 1;
+  else if (!force_p && detect_input_pending ())
     {
       pause = 1;
       goto do_pause;
     }
 
-  update_begin (f);
-
   /* If we cannot insert/delete lines, it's no use trying it.  */
   if (!line_ins_del_ok)
     inhibit_id_p = 1;
@@ -4829,15 +4885,8 @@ update_frame_1 (f, force_p, inhibit_id_p)
        }
     }
 
-  update_end (f);
-
-  if (termscript)
-    fflush (termscript);
-  fflush (stdout);
-
  do_pause:
 
-  display_completed = !pause;
   clear_desired_matrices (f);
   return pause;
 }
@@ -5345,7 +5394,7 @@ buffer_posn_from_coords (w, x, y)
 Lisp_Object
 mode_line_string (w, x, y, mode_line_p, charpos)
      struct window *w;
-     int x, y;
+     int x, y, mode_line_p;
      int *charpos;
 {
   struct glyph_row *row;
@@ -5396,7 +5445,9 @@ window_change_signal (signalnum) /* If we don't have an argument, */
      int signalnum;            /* some compilers complain in signal calls.  */
 {
   int width, height;
+#ifndef USE_CRT_DLL
   extern int errno;
+#endif
   int old_errno = errno;
 
   get_frame_size (&width, &height);
@@ -6195,6 +6246,8 @@ syms_of_display ()
 
   Qdisplay_table = intern ("display-table");
   staticpro (&Qdisplay_table);
+  Qredisplay_dont_pause = intern ("redisplay-dont-pause");
+  staticpro (&Qredisplay_dont_pause);
 
   DEFVAR_INT ("baud-rate", &baud_rate,
     "*The output baud rate of the terminal.\n\