(change_frame_size_1): Save current buffer
[bpt/emacs.git] / src / dispnew.c
index 4c0cd1b..a7441b9 100644 (file)
@@ -1,5 +1,6 @@
 /* Updating of data structures for redisplay.
-   Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc.
+   Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 1997
+       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1093,7 +1094,7 @@ direct_output_for_insert (g)
   unchanged_modified = MODIFF;
   beg_unchanged = GPT - BEG;
   XSETFASTINT (w->last_point, PT);
-  XSETFASTINT (w->last_point_x, hpos);
+  XSETFASTINT (w->last_point_x, hpos + 1);
   XSETFASTINT (w->last_modified, MODIFF);
   XSETFASTINT (w->last_overlay_modified, OVERLAY_MODIFF);
 
@@ -1117,14 +1118,12 @@ direct_output_forward_char (n)
   register FRAME_PTR frame = selected_frame;
   register struct window *w = XWINDOW (selected_window);
   Lisp_Object position;
-  /* This check is redundant.  It's checked at "losing cursor" below.  */
-#if 0
   int hpos = FRAME_CURSOR_X (frame);
 
   /* Give up if in truncated text at end of line.  */
+  /* This check is not redundant.  */
   if (hpos >= WINDOW_LEFT_MARGIN (w) + window_internal_width (w) - 1)
     return 0;
-#endif /* 0 */
 
   /* Give up if the buffer's direction is reversed (i.e. right-to-left).  */
   if (!NILP (XBUFFER(w->buffer)->direction_reversed))
@@ -1428,9 +1427,17 @@ scrolling (frame)
        return 0;
       old_hash[i] = line_hash_code (current_frame, i);
       if (! desired_frame->enable[i])
-       new_hash[i] = old_hash[i];
+       {
+         /* This line cannot be redrawn, so don't let scrolling mess it.  */
+         new_hash[i] = old_hash[i];
+#define INFINITY 1000000       /* Taken from scroll.c */
+         draw_cost[i] = INFINITY;
+       }
       else
-       new_hash[i] = line_hash_code (desired_frame, i);
+       {
+         new_hash[i] = line_hash_code (desired_frame, i);
+         draw_cost[i] = line_draw_cost (desired_frame, i);
+       }
 
       if (old_hash[i] != new_hash[i])
        {
@@ -1439,7 +1446,6 @@ scrolling (frame)
        }
       else if (i == unchanged_at_top)
        unchanged_at_top++;
-      draw_cost[i] = line_draw_cost (desired_frame, i);
       old_draw_cost[i] = line_draw_cost (current_frame, i);
     }
 
@@ -2120,6 +2126,7 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
 {
   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)
@@ -2226,9 +2233,13 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
 
   UNBLOCK_INPUT;
 
+  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+
   /* This isn't quite a no-op: it runs window-configuration-change-hook.  */
   Fset_window_buffer (FRAME_SELECTED_WINDOW (frame),
                      XWINDOW (FRAME_SELECTED_WINDOW (frame))->buffer);
+
+  unbind_to (count, Qnil);
 }
 \f
 DEFUN ("send-string-to-terminal", Fsend_string_to_terminal,
@@ -2491,7 +2502,11 @@ init_display ()
       display_arg = (display != 0 && *display != 0);
     }
 
-  if (!inhibit_window_system && display_arg && initialized)
+  if (!inhibit_window_system && display_arg 
+#ifndef CANNOT_DUMP
+     && initialized
+#endif
+     )
     {
       Vwindow_system = intern ("x");
 #ifdef HAVE_X11