* keyboard.c (read_key_sequence): When we generate a prefix symbol
[bpt/emacs.git] / src / xdisp.c
index ba33e11..3acdaed 100644 (file)
@@ -92,6 +92,9 @@ static Lisp_Object last_arrow_position, last_arrow_string;
 /* Nonzero if overlay arrow has been displayed once in this window.  */
 static int overlay_arrow_seen;
 
+/* Nonzero means highlight the region even in nonselected windows.  */
+static int highlight_nonselected_windows;
+
 /* If cursor motion alone moves point off frame,
    Try scrolling this many lines up or down if that will bring it back.  */
 int scroll_step;
@@ -309,7 +312,7 @@ echo_area_display ()
 
   if (frame_garbaged)
     {
-      Fredraw_display ();
+      redraw_garbaged_frames ();
       frame_garbaged = 0;
     }
 
@@ -391,7 +394,7 @@ redisplay ()
 
   if (frame_garbaged)
     {
-      Fredraw_display ();
+      redraw_garbaged_frames ();
       frame_garbaged = 0;
     }
 
@@ -947,6 +950,8 @@ redisplay_window (window, just_this_one)
   else if (just_this_one && !MINI_WINDOW_P (w)
           && point >= startp
           && XFASTINT (w->last_modified)
+          /* or else vmotion on first line won't work.  */
+          && ! NILP (w->start_at_line_beg)
           && ! EQ (w->window_end_valid, Qnil)
           && do_id && !clip_changed
           && !blank_end_of_window
@@ -1060,15 +1065,23 @@ done:
       int start, end, whole;
 
       /* Calculate the start and end positions for the current window.
+        At some point, it would be nice to choose between scrollbars
+        which reflect the whole buffer size, with special markers
+        indicating narrowing, and scrollbars which reflect only the
+        visible region.
+
         Note that minibuffers sometimes aren't displaying any text.  */
       if (! MINI_WINDOW_P (w)
          || (w == XWINDOW (minibuf_window) && ! echo_area_glyphs))
        {
-         start = startp;
+         whole = ZV - BEGV;
+         start = startp - BEGV;
          /* I don't think this is guaranteed to be right.  For the
             moment, we'll pretend it is.  */
-         end = Z - XINT (w->window_end_pos);
-         whole = Z - BEG;
+         end = (Z - XINT (w->window_end_pos)) - BEGV;
+
+         if (end < start) end = start;
+         if (whole < (end - start)) whole = end - start;
        }
       else
        start = end = whole = 0;
@@ -1654,7 +1667,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
   register unsigned char *p;
   GLYPH *endp;
   register GLYPH *startp;
-  register GLYPH *p1prev;
+  register GLYPH *p1prev = 0;
   FRAME_PTR f = XFRAME (w->frame);
   int tab_width = XINT (current_buffer->tab_width);
   int ctl_arrow = !NILP (current_buffer->ctl_arrow);
@@ -1715,7 +1728,10 @@ display_text_line (w, start, vpos, hpos, taboffset)
   if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
 
   /* Show where to highlight the region.  */
-  if (highlight_region && XMARKER (current_buffer->mark)->buffer != 0)
+  if (highlight_region && XMARKER (current_buffer->mark)->buffer != 0
+      /* Maybe highlight only in selected window.  */
+      && (highlight_nonselected_windows
+         || w == XWINDOW (selected_window)))
     {
       region_beg = marker_position (current_buffer->mark);
       if (PT < region_beg)
@@ -1780,7 +1796,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
          /* Did we hit a face change?  Figure out what face we should
             use now.  We also hit this the first time through the
             loop, to see what face we should start with.  */
-         if (pos == next_face_change)
+         if (pos == next_face_change && FRAME_X_P (f))
            current_face = compute_char_face (f, w, pos,
                                              region_beg, region_end,
                                              &next_face_change);
@@ -1828,6 +1844,13 @@ display_text_line (w, start, vpos, hpos, taboffset)
              copy_part_of_rope (p1prev, p1prev, invis_vector_contents,
                                 (p1 - p1prev), current_face);
            }
+#if 1
+         /* Draw the face of the newline character as extending all the 
+            way to the end of the frame line.  */
+         if (current_face)
+           while (p1 < endp)
+             *p1++ = MAKE_GLYPH (' ', current_face);
+#endif
          break;
        }
       else if (c == '\t')
@@ -1854,6 +1877,13 @@ display_text_line (w, start, vpos, hpos, taboffset)
              copy_part_of_rope (p1prev, p1prev, invis_vector_contents,
                                 (p1 - p1prev), current_face);
            }
+#if 1
+         /* Draw the face of the newline character as extending all the 
+            way to the end of the frame line.  */
+         if (current_face)
+           while (p1 < endp)
+             *p1++ = MAKE_GLYPH (' ', current_face);
+#endif
          break;
        }
       else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector)
@@ -1904,10 +1934,16 @@ display_text_line (w, start, vpos, hpos, taboffset)
   /* by backing up over it */
   if (p1 > endp)
     {
-      /* Start the next line with that same character */
-      pos--;
-      /* but at a negative hpos, to skip the columns output on this line.  */
-      val.hpos += p1prev - endp;
+      /* Don't back up if we never actually displayed any text.
+        This occurs when the minibuffer prompt takes up the whole line.  */
+      if (p1prev)
+       {
+         /* Start the next line with that same character */
+         pos--;
+         /* but at negative hpos, to skip the columns output on this line.  */
+         val.hpos += p1prev - endp;
+       }
+
       /* Keep in this line everything up to the continuation column.  */
       p1 = endp;
     }
@@ -2812,6 +2848,10 @@ If this is zero, point is always centered after it moves off frame.");
   DEFVAR_INT ("line-number-display-limit", &line_number_display_limit,
     "*Maximum buffer size for which line number should be displayed.");
   line_number_display_limit = 1000000;
+
+  DEFVAR_BOOL ("highlight-nonselected-windows", &highlight_nonselected_windows,
+    "*Non-nil means highlight region even in nonselected windows.");
+  highlight_nonselected_windows = 1;
 }
 
 /* initialize the window system */