diff src/xdisp.c @ 83494:b901f4f12f33

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-160 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-161 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-162 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-163 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-164 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-165 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-166 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-167 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-168 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-169 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-170 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-171 Update from CVS: man/mh-e.texi (Folders): Various edits. * emacs@sv.gnu.org/emacs--devo--0--patch-172 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-58 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-59 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-60 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-61 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-62 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-63 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-64 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-534
author Karoly Lorentey <lorentey@elte.hu>
date Wed, 22 Mar 2006 15:16:06 +0000
parents 0cdee8b991e1 fad358cc93fc
children c1e013e3dc0e
line wrap: on
line diff
--- a/src/xdisp.c	Tue Mar 21 22:32:30 2006 +0000
+++ b/src/xdisp.c	Wed Mar 22 15:16:06 2006 +0000
@@ -9443,7 +9443,12 @@
    HEIGHT specifies the desired height of the tool-bar line.
    If the actual height of the glyph row is less than HEIGHT, the
    row's height is increased to HEIGHT, and the icons are centered
-   vertically in the new height.  */
+   vertically in the new height.
+
+   If HEIGHT is -1, we are counting needed tool-bar lines, so don't
+   count a final empty row in case the tool-bar width exactly matches
+   the window width.
+*/
 
 static void
 display_tool_bar_line (it, height)
@@ -9467,7 +9472,12 @@
 
       /* Get the next display element.  */
       if (!get_next_display_element (it))
-	break;
+	{
+	  /* Don't count empty row if we are counting needed tool-bar lines.  */
+	  if (height < 0 && !it->hpos)
+	    return;
+	  break;
+	}
 
       /* Produce glyphs.  */
       x_before = it->current_x;
@@ -9565,11 +9575,12 @@
     {
       it.glyph_row = w->desired_matrix->rows;
       clear_glyph_row (it.glyph_row);
-      display_tool_bar_line (&it, 0);
-    }
-
+      display_tool_bar_line (&it, -1);
+    }
+
+  /* f->n_tool_bar_rows == 0 means "unknown"; -1 means no tool-bar.  */
   if (n_rows)
-    *n_rows = it.vpos;
+    *n_rows = it.vpos > 0 ? it.vpos : -1;
 
   return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
 }
@@ -9645,11 +9656,7 @@
   reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
 
   if (f->n_tool_bar_rows == 0)
-    {
-      (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
-      if (f->n_tool_bar_rows == 0)
-	f->n_tool_bar_rows = -1;
-    }
+    (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
 
   /* Display as many lines as needed to display all tool-bar items.  */
 
@@ -11607,7 +11614,7 @@
 	  x += glyph->pixel_width;
 	  ++glyph;
 	  if (cursor_from_overlay_pos
-	      && last_pos > cursor_from_overlay_pos)
+	      && last_pos >= cursor_from_overlay_pos)
 	    {
 	      cursor_from_overlay_pos = 0;
 	      cursor = 0;
@@ -11621,10 +11628,12 @@
 	  /* Skip all glyphs from string.  */
 	  do
 	    {
+	      Lisp_Object cprop;
 	      int pos;
 	      if ((cursor == NULL || glyph > cursor)
-		  && !NILP (Fget_char_property (make_number ((glyph)->charpos),
-						Qcursor, (glyph)->object))
+		  && (cprop = Fget_char_property (make_number ((glyph)->charpos),
+						  Qcursor, (glyph)->object),
+		      !NILP (cprop))
 		  && (pos = string_buffer_position (w, glyph->object,
 						    string_before_pos),
 		      (pos == 0	  /* From overlay */
@@ -11635,14 +11644,15 @@
 		     Add 1 to last_pos so that if point corresponds to the
 		     glyph right after the overlay, we still use a 'cursor'
 		     property found in that overlay.  */
-		  cursor_from_overlay_pos = pos == 0 ? last_pos+1 : 0;
+		  cursor_from_overlay_pos = (pos ? 0 : last_pos
+					     + (INTEGERP (cprop) ? XINT (cprop) : 0));
 		  cursor = glyph;
 		  cursor_x = x;
 		}
 	      x += glyph->pixel_width;
 	      ++glyph;
 	    }
-	  while (glyph < end && STRINGP (glyph->object));
+	  while (glyph < end && EQ (glyph->object, string_start->object));
 	}
     }
 
@@ -15373,6 +15383,7 @@
     face = FACE_FROM_ID (f, it->face_id);
 
   if (FRAME_WINDOW_P (f)
+      && it->glyph_row->displays_text_p
       && face->box == FACE_NO_BOX
       && face->background == FRAME_BACKGROUND_PIXEL (f)
       && !face->stipple)
@@ -19390,7 +19401,7 @@
    Called from x_produce_glyphs when IT->glyph_row is non-null.  */
 
 static INLINE void
-append_glyph (it)
+store_next_glyph (it)
      struct it *it;
 {
   struct glyph *glyph;
@@ -19714,7 +19725,7 @@
    ASCENT must be in the range 0 <= ASCENT <= 100.  */
 
 static void
-produce_stretch_glyph (it)
+generate_stretch_glyph (it)
      struct it *it;
 {
   /* (space :width WIDTH :height HEIGHT ...)  */
@@ -20140,7 +20151,7 @@
 					it->ascent + it->descent, ascent);
 		}
 	      else
-		append_glyph (it);
+		store_next_glyph (it);
 
 	      /* If characters with lbearing or rbearing are displayed
 		 in this line, record that fact in a flag of the
@@ -20322,7 +20333,7 @@
 	  take_vertical_position_into_account (it);
 
 	  if (it->glyph_row)
-	    append_glyph (it);
+	    store_next_glyph (it);
 	}
       it->multibyte_p = saved_multibyte_p;
     }
@@ -20602,7 +20613,7 @@
   else if (it->what == IT_IMAGE)
     produce_image_glyph (it);
   else if (it->what == IT_STRETCH)
-    produce_stretch_glyph (it);
+    generate_stretch_glyph (it);
 
   /* Accumulate dimensions.  Note: can't assume that it->descent > 0
      because this isn't true for images with `:ascent 100'.  */