* keyboard.c (read_key_sequence): When we generate a prefix symbol
[bpt/emacs.git] / src / xdisp.c
index b991aeb..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
@@ -1662,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);
@@ -1723,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)
@@ -1788,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);
@@ -1926,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;
     }
@@ -2834,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 */