changeset 43667:65b7d85cfbc1

(display_mode_element): Move the places where bytepos, charpos, this, and lisp_string are set. Use lisp_string to set bytepos. (display_mode_element): Merge properties specified with :propertize onto those that come with the string. (redisplay_internal): Call clear_image_cache only if HAVE_WINDOW_SYSTEM.
author Richard M. Stallman <rms@gnu.org>
date Sun, 03 Mar 2002 20:02:08 +0000
parents a84483ed5134
children 771bbdee433b
files src/xdisp.c
diffstat 1 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Sun Mar 03 17:41:19 2002 +0000
+++ b/src/xdisp.c	Sun Mar 03 20:02:08 2002 +0000
@@ -8878,9 +8878,11 @@
 	  
 	  if (FRAME_WINDOW_P (f) || f == sf)
 	    {
+#ifdef HAVE_WINDOW_SYSTEM
 	      if (clear_face_cache_count % 50 == 0
 		  && FRAME_WINDOW_P (f))
 		clear_image_cache (f, 0);
+#endif /* HAVE_WINDOW_SYSTEM */
 
 	      /* Mark all the scroll bars to be removed; we'll redeem
 		 the ones we want when we redisplay their windows.  */
@@ -13598,8 +13600,7 @@
       {
 	/* A string: output it and check for %-constructs within it.  */
 	unsigned char c;
-	unsigned char *this = XSTRING (elt)->data;
-	unsigned char *lisp_string = this;
+	unsigned char *this, *lisp_string;
 
 	if (!NILP (props))
 	  {
@@ -13607,6 +13608,23 @@
 	    oprops = Ftext_properties_at (make_number (0), elt);
 	    if (NILP (Fequal (props, oprops)))
 	      {
+		/* If the starting string has properties,
+		   merge the specified ones onto the existing ones.  */
+		if (! NILP (oprops))
+		  {
+		    Lisp_Object tem;
+
+		    oprops = Fcopy_sequence (oprops);
+		    tem = props;
+		    while (CONSP (tem))
+		      {
+			oprops = Fplist_put (oprops, XCAR (tem),
+					     XCAR (XCDR (tem)));
+			tem = XCDR (XCDR (tem));
+		      }
+		    props = oprops;
+		  }
+
 		aelt = Fassoc (elt, mode_line_proptrans_alist);
 		if (! NILP (aelt) && !NILP (Fequal (props, XCDR (aelt))))
 		  elt = XCAR (aelt);
@@ -13621,6 +13639,9 @@
 	      }
 	  }
 
+	this = XSTRING (elt)->data;
+	lisp_string = this;
+
 	if (literal)
 	  {
 	    prec = precision - n;
@@ -13689,20 +13710,24 @@
 		else if (c != 0)
 		  {
 		    int multibyte;
-		    unsigned char *spec
+		    int bytepos, charpos;
+		    unsigned char *spec;
+			
+		    bytepos = percent_position - lisp_string;
+		    charpos = (STRING_MULTIBYTE (elt)
+			       ? string_byte_to_char (elt, bytepos)
+			       : bytepos);
+
+		    spec
 		      = decode_mode_spec (it->w, c, field, prec, &multibyte);
 
 		    if (frame_title_ptr)
 		      n += store_frame_title (spec, field, prec);
 		    else
 		      {
-			int nglyphs_before, bytepos, charpos, nwritten;
+			int nglyphs_before, nwritten;
 			
 			nglyphs_before = it->glyph_row->used[TEXT_AREA];
-			bytepos = percent_position - XSTRING (elt)->data;
-			charpos = (STRING_MULTIBYTE (elt)
-				   ? string_byte_to_char (elt, bytepos)
-				   : bytepos);
 			nwritten = display_string (spec, Qnil, elt,
 						   charpos, 0, it,
 						   field, prec, 0,