]> code.delx.au - gnu-emacs/blobdiff - src/xdisp.c
automatically generated from GPLed version
[gnu-emacs] / src / xdisp.c
index a54ad86e3baf8e8105b778bf699a74a7739c78df..d7c0bfe34bc3f9cb4da56167ea6afad7d11f3e40 100644 (file)
@@ -1,5 +1,6 @@
 /* Display generation from window structure and buffer text.
-   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.
 
@@ -417,7 +418,8 @@ message2_nolog (m, len)
       if (noninteractive_need_newline)
        putc ('\n', stderr);
       noninteractive_need_newline = 0;
-      fwrite (m, len, 1, stderr);
+      if (m)
+       fwrite (m, len, 1, stderr);
       if (cursor_in_echo_area == 0)
        fprintf (stderr, "\n");
       fflush (stderr);
@@ -628,7 +630,8 @@ echo_area_display ()
                      echo_area_glyphs ? echo_area_glyphs : "",
                      echo_area_glyphs ? echo_area_glyphs_length : -1,
                      FRAME_LEFT_SCROLL_BAR_WIDTH (f),
-                     0, 0, 0, FRAME_WIDTH (f));
+                     0, 0, 0,
+                     FRAME_WIDTH (f) + FRAME_LEFT_SCROLL_BAR_WIDTH (f));
 
 #if 0 /* This just gets in the way.  update_frame does the job.  */
       /* If desired cursor location is on this line, put it at end of text */
@@ -646,10 +649,13 @@ echo_area_display ()
             i < vpos + XFASTINT (XWINDOW (mini_window)->height); i++)
          {
            get_display_line (f, i, 0);
-           display_string (XWINDOW (mini_window), vpos,
+           /* We don't use FRAME_SCROLL_BAR_WIDTH (f) as the starting
+              hpos, because it is good to clear whatever is behind the
+              scroll bar.  This does not affect the scroll bar itself.  */
+           display_string (XWINDOW (mini_window), i,
                            "", 0, 
-                            FRAME_LEFT_SCROLL_BAR_WIDTH (f),
-                           0, 0, 0, FRAME_WIDTH (f));
+                            0, 0, 0,
+                            0, FRAME_WIDTH (f) + FRAME_SCROLL_BAR_WIDTH (f));
          }
       }
     }
@@ -864,6 +870,7 @@ redisplay_internal (preserve_echo_area)
   int all_windows;
   register int tlbufpos, tlendpos;
   struct position pos;
+  int number_of_frames_redisplayed;
 
   if (noninteractive)
     return;
@@ -873,6 +880,8 @@ redisplay_internal (preserve_echo_area)
     return;
 #endif
 
+ retry:
+
   if (! FRAME_WINDOW_P (selected_frame)
       && previous_terminal_frame != selected_frame)
     {
@@ -962,6 +971,9 @@ redisplay_internal (preserve_echo_area)
                  Fmarker_position (XBUFFER (w->buffer)->mark))))
     this_line_bufpos = -1;
 
+  /* This is in case we goto update, below.  */
+  number_of_frames_redisplayed = 1;
+
   tlbufpos = this_line_bufpos;
   tlendpos = this_line_endpos;
   if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line)
@@ -1136,6 +1148,7 @@ redisplay_internal (preserve_echo_area)
       /* Recompute # windows showing selected buffer.
         This will be incremented each time such a window is displayed.  */
       buffer_shared = 0;
+      number_of_frames_redisplayed = 0;
 
       FOR_EACH_FRAME (tail, frame)
        {
@@ -1149,7 +1162,10 @@ redisplay_internal (preserve_echo_area)
                (*condemn_scroll_bars_hook) (f);
 
              if (FRAME_VISIBLE_P (f))
-               redisplay_windows (FRAME_ROOT_WINDOW (f), preserve_echo_area);
+               {
+                 redisplay_windows (FRAME_ROOT_WINDOW (f), preserve_echo_area);
+                 number_of_frames_redisplayed++;
+               }
 
              /* Any scroll bars which redisplay_windows should have nuked
                 should now go away.  */
@@ -1163,6 +1179,7 @@ redisplay_internal (preserve_echo_area)
       redisplay_window (selected_window, 1, preserve_echo_area);
       if (!WINDOW_FULL_WIDTH_P (w))
        preserve_other_columns (w);
+      number_of_frames_redisplayed = 1;
     }
 
 update: 
@@ -1304,13 +1321,37 @@ update:
     request_sigio ();
   start_polling ();
 
+  /* If something has become visible now which was not before,
+     redisplay again, so that we get them.  */
+  if (!pause)
+    {
+      Lisp_Object tail, frame;
+      int new_count = 0;
+
+      FOR_EACH_FRAME (tail, frame)
+       {
+         int this_is_visible = 0;
+         if (XFRAME (frame)->visible)
+           this_is_visible = 1;
+         FRAME_SAMPLE_VISIBILITY (XFRAME (frame));
+         if (XFRAME (frame)->visible)
+           this_is_visible = 1;
+
+         if (this_is_visible)
+           new_count++;
+       }
+
+      if (new_count != number_of_frames_redisplayed)
+       windows_or_buffers_changed++;
+    }
+
   /* Change frame size now if a change is pending.  */
   do_pending_window_change ();
 
-  /* If we just did a pending size change, redisplay again
-     for the new size.  */
+  /* If we just did a pending size change, or have additional
+     visible frames, redisplay again.  */
   if (windows_or_buffers_changed && !pause)
-    redisplay ();
+    goto retry;
 }
 
 /* Redisplay, but leave alone any recent echo area message
@@ -2952,7 +2993,7 @@ display_text_line (w, start, vpos, hpos, taboffset, ovstr_done)
   next_boundary = pos;
   p1prev = p1;
   prevpos = pos;
-  while (1)
+  while (p1 < endp)
     {
       if (pos >= pause)
        {
@@ -3670,7 +3711,7 @@ display_menu_bar (w)
       XSETFASTINT (XVECTOR (items)->contents[i + 3], hpos);
 
       if (hpos < maxendcol)
-       hpos = display_string (XWINDOW (FRAME_ROOT_WINDOW (f)), vpos,
+       hpos = display_string (w, vpos,
                               XSTRING (string)->data,
                               XSTRING (string)->size,
                               hpos, 0, 0, hpos, maxendcol);
@@ -4023,31 +4064,49 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
      register char *buf;
      int eol_flag;
 {
-  register Lisp_Object val = coding_system;
+  Lisp_Object val;
+
+  val = coding_system;
 
   if (NILP (val))              /* Not yet decided.  */
     {
       *buf++ = '-';
-      if (eol_flag) *buf++ = eol_mnemonic_undecided;
+      if (eol_flag)
+       *buf++ = eol_mnemonic_undecided;
+      /* Don't mention EOL conversion if it isn't decided.  */
     }
   else
     {
+      Lisp_Object eolvalue;
+
+      eolvalue = Fget (coding_system, Qeol_type);
+
       while (!NILP (val) && SYMBOLP (val))
-       val = Fget (val, Qcoding_system);
+       {
+         val = Fget (val, Qcoding_system);
+         if (NILP (eolvalue))
+           eolvalue = Fget (coding_system, Qeol_type);
+       }
+
       *buf++ = XFASTINT (XVECTOR (val)->contents[1]);
       if (eol_flag)
        {
-         val = Fget (coding_system, Qeol_type);
-
-         if (NILP (val))       /* Not yet decided.  */
-           *buf++ = eol_mnemonic_undecided;
-         else if (VECTORP (val)) /* Not yet decided.  */
-           *buf++ = eol_mnemonic_undecided;
-         else                  /* INTEGERP (val) -- 1:LF, 2:CRLF, 3:CR */
-           *buf++ = (XFASTINT (val) == 1
-                     ? eol_mnemonic_unix
-                     : (XFASTINT (val) == 2
-                        ? eol_mnemonic_dos : eol_mnemonic_mac));
+         /* The EOL conversion we are using.  */
+         int eoltype;
+         /* The EOL conversion that is normal on this system.  */
+
+         if (NILP (eolvalue))  /* Not yet decided.  */
+           eoltype = eol_mnemonic_undecided;
+         else if (VECTORP (eolvalue)) /* Not yet decided.  */
+           eoltype = eol_mnemonic_undecided;
+         else                  /* INTEGERP (eolvalue) -- 0:LF, 1:CRLF, 2:CR */
+           eoltype = (XFASTINT (eolvalue) == 0
+                      ? eol_mnemonic_unix
+                      : (XFASTINT (eolvalue) == 1
+                         ? eol_mnemonic_dos : eol_mnemonic_mac));
+
+         /* Mention the EOL conversion if it is not the usual one.  */
+         *buf++ = eoltype;
        }
     }
   return buf;
@@ -4382,15 +4441,19 @@ decode_mode_spec (w, c, spec_width, maxwidth)
       /* coding-system (including end-of-line type) */
       {
        int eol_flag = (c == 'Z');
-       char *p;
+       char *p = decode_mode_spec_buf;
 
-       p = decode_mode_spec_coding (b->buffer_file_coding_system,
-                                    decode_mode_spec_buf, eol_flag);
        if (FRAME_TERMCAP_P (f))
          {
-           p = decode_mode_spec_coding (keyboard_coding.symbol, p, eol_flag);
-           p = decode_mode_spec_coding (terminal_coding.symbol, p, eol_flag);
+           /* No need to mention EOL here--the terminal never needs
+              to do EOL conversion.  */
+           p = decode_mode_spec_coding (keyboard_coding.symbol, p, 0);
+           p = decode_mode_spec_coding (terminal_coding.symbol, p, 0);
          }
+       p = decode_mode_spec_coding (b->buffer_file_coding_system,
+                                    p, eol_flag);
+
+#if 0 /* This proves to be annoying; I think we can do without.  -- rms.  */
 #ifdef subprocesses
        obj = Fget_buffer_process (Fcurrent_buffer ());
        if (PROCESSP (obj))
@@ -4401,6 +4464,7 @@ decode_mode_spec (w, c, spec_width, maxwidth)
                                         p, eol_flag);
          }
 #endif /* subprocesses */
+#endif /* 0 */
        *p = 0;
        return decode_mode_spec_buf;
       }