(dos_rawgetc): Doc fix. Make C-, S-, and M- modifiers
[bpt/emacs.git] / src / xdisp.c
index 8cb80ad..18ae7e8 100644 (file)
@@ -94,6 +94,8 @@ Lisp_Object Voverlay_arrow_string;
 /* Values of those variables at last redisplay.  */
 static Lisp_Object last_arrow_position, last_arrow_string;
 
+Lisp_Object Qmenu_bar_update_hook;
+
 /* Nonzero if overlay arrow has been displayed once in this window.  */
 static int overlay_arrow_seen;
 
@@ -927,12 +929,11 @@ update_menu_bar (f)
   if (update_mode_lines)
     w->update_mode_line = Qt;
 
-  /* When we reach a frame's selected window, redo the frame's menu bar.  */
-  if (!NILP (w->update_mode_line)
+  if (
 #ifdef USE_X_TOOLKIT
-      && FRAME_EXTERNAL_MENU_BAR (f) 
+      FRAME_EXTERNAL_MENU_BAR (f) 
 #else
-      && FRAME_MENU_BAR_LINES (f) > 0
+      FRAME_MENU_BAR_LINES (f) > 0
 #endif
       )
     {
@@ -944,12 +945,13 @@ update_menu_bar (f)
         the rest of the redisplay algorithm is about the same as
         windows_or_buffers_changed anyway.  */
       if (windows_or_buffers_changed
-         || update_mode_lines
+         || !NILP (w->update_mode_line)
          || (XFASTINT (w->last_modified) < MODIFF
              && (XFASTINT (w->last_modified)
                  <= XBUFFER (w->buffer)->save_modified)))
        {
          struct buffer *prev = current_buffer;
+         call1 (Vrun_hooks, Qmenu_bar_update_hook);
          current_buffer = XBUFFER (w->buffer);
          FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
          current_buffer = prev;
@@ -2049,7 +2051,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
   p1start = p1;
   charstart = desired_glyphs->charstarts[vpos] + hpos;
   /* In case we don't ever write anything into it...  */
-  *charstart = -1;
+  desired_glyphs->charstarts[vpos][XFASTINT (w->left)] = -1;
   end = ZV;
   leftmargin = desired_glyphs->glyphs[vpos] + XFASTINT (w->left);
   endp = leftmargin + width;
@@ -2168,7 +2170,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
       else if (c == '\n')
        {
          invis = 0;
-         while (pos < end
+         while (pos + 1 < end
                 && selective > 0
                 && indented_beyond_p (pos + 1, selective))
            {
@@ -2278,12 +2280,12 @@ display_text_line (w, start, vpos, hpos, taboffset)
                 And don't clobber anything to the left of that.  */
              if (p1prev < leftmargin)
                {
-                 charstart[0] = pos;
-                 p2x = charstart;
+                 p2x = charstart + (leftmargin - p1start);
+                 *p2x = pos;
                }
 
              /* This loop skips over the char p2x initially points to.  */
-             while (++p2x != p2)
+             while (++p2x < p2)
                *p2x = -1;
            }
        }
@@ -2305,7 +2307,10 @@ display_text_line (w, start, vpos, hpos, taboffset)
   /* Add 1 in the endtest to compensate for the fact that ENDP was
      made from WIDTH, which is 1 less than the window's actual
      internal width.  */
-  for (i = p1 - p1start + 1; i < endp - p1start + 1; i++)
+  i = p1 - p1start + 1;
+  if (p1 < leftmargin)
+    i += leftmargin - p1;
+  for (; i < endp - p1start + 1; i++)
     charstart[i] = 0;
 
   /* Handle continuation in middle of a character */
@@ -2945,10 +2950,7 @@ decode_mode_spec (w, c, maxwidth)
 
     case 't':                  /* indicate TEXT or BINARY */
 #ifdef MSDOS
-      decode_mode_spec_buf[0]
-       = NILP (current_buffer->buffer_file_type) ? "T" : "B";
-      decode_mode_spec_buf[1] = 0;
-      return decode_mode_spec_buf;
+      return NILP (current_buffer->buffer_file_type) ? "T" : "B";
 #else /* not MSDOS */
       return "T";
 #endif /* not MSDOS */
@@ -3271,6 +3273,9 @@ display_string (w, vpos, string, length, hpos, truncate,
 void
 syms_of_xdisp ()
 {
+  staticpro (&Qmenu_bar_update_hook);
+  Qmenu_bar_update_hook = intern ("menu-bar-update-hook");
+
   staticpro (&last_arrow_position);
   staticpro (&last_arrow_string);
   last_arrow_position = Qnil;