changeset 65542:b695b0dc3532

(overlay_arrow_at_row): Add HAVE_WINDOW_SYSTEM conditional. (display_mode_element): Instead of `lisp_string' and `this', record `offset' and increment that. `last_offset' replaces `last'.
author Richard M. Stallman <rms@gnu.org>
date Thu, 15 Sep 2005 13:16:53 +0000
parents 418933eb8310
children 27612d890a6c
files src/xdisp.c
diffstat 1 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Thu Sep 15 13:13:54 2005 +0000
+++ b/src/xdisp.c	Thu Sep 15 13:16:53 2005 +0000
@@ -10019,12 +10019,14 @@
 	  if (FRAME_WINDOW_P (it->f)
 	      && WINDOW_LEFT_FRINGE_WIDTH (it->w) > 0)
 	    {
+#ifdef HAVE_WINDOW_SYSTEM
 	      if (val = Fget (var, Qoverlay_arrow_bitmap), SYMBOLP (val))
 		{
 		  int fringe_bitmap;
 		  if ((fringe_bitmap = lookup_fringe_bitmap (val)) != 0)
 		    return make_number (fringe_bitmap);
 		}
+#endif
 	      return make_number (-1); /* Use default arrow bitmap */
 	    }
 	  return overlay_arrow_string_or_property (var);
@@ -15959,7 +15961,7 @@
       {
 	/* A string: output it and check for %-constructs within it.  */
 	unsigned char c;
-	const unsigned char *this, *lisp_string;
+	int offset = 0;
 
 	if (!NILP (props) || risky)
 	  {
@@ -16017,8 +16019,7 @@
 	      }
 	  }
 
-	this = SDATA (elt);
-	lisp_string = this;
+	offset = 0;
 
 	if (literal)
 	  {
@@ -16041,42 +16042,44 @@
 	    break;
 	  }
 
+	/* Handle the non-literal case.  */
+
 	while ((precision <= 0 || n < precision)
-	       && *this
+	       && SREF (elt, offset) != 0
 	       && (mode_line_target != MODE_LINE_DISPLAY
 		   || it->current_x < it->last_visible_x))
 	  {
-	    const unsigned char *last = this;
+	    int last_offset = offset;
 
 	    /* Advance to end of string or next format specifier.  */
-	    while ((c = *this++) != '\0' && c != '%')
+	    while ((c = SREF (elt, offset++)) != '\0' && c != '%')
 	      ;
 
-	    if (this - 1 != last)
+	    if (offset - 1 != last_offset)
 	      {
 		int nchars, nbytes;
 
 		/* Output to end of string or up to '%'.  Field width
 		   is length of string.  Don't output more than
 		   PRECISION allows us.  */
-		--this;
-
-		prec = c_string_width (last, this - last, precision - n,
+		offset--;
+
+		prec = c_string_width (SDATA (elt) + last_offset,
+				       offset - last_offset, precision - n,
 				       &nchars, &nbytes);
 
 		switch (mode_line_target)
 		  {
 		  case MODE_LINE_NOPROP:
 		  case MODE_LINE_TITLE:
-		    n += store_mode_line_noprop (last, 0, prec);
+		    n += store_mode_line_noprop (SDATA (elt) + last_offset, 0, prec);
 		    break;
 		  case MODE_LINE_STRING:
 		    {
-		      int bytepos = last - lisp_string;
+		      int bytepos = last_offset;
 		      int charpos = string_byte_to_char (elt, bytepos);
 		      int endpos = (precision <= 0
-				    ? string_byte_to_char (elt,
-							   this - lisp_string)
+				    ? string_byte_to_char (elt, offset)
 				    : charpos + nchars);
 
 		      n += store_mode_line_string (NULL,
@@ -16087,7 +16090,7 @@
 		    break;
 		  case MODE_LINE_DISPLAY:
 		    {
-		      int bytepos = last - lisp_string;
+		      int bytepos = last_offset;
 		      int charpos = string_byte_to_char (elt, bytepos);
 		      n += display_string (NULL, elt, Qnil, 0, charpos,
 					   it, 0, prec, 0,
@@ -16098,12 +16101,12 @@
 	      }
 	    else /* c == '%' */
 	      {
-		const unsigned char *percent_position = this;
+		int percent_position = offset;
 
 		/* Get the specified minimum width.  Zero means
 		   don't pad.  */
 		field = 0;
-		while ((c = *this++) >= '0' && c <= '9')
+		while ((c = SREF (elt, offset++)) >= '0' && c <= '9')
 		  field = field * 10 + c - '0';
 
 		/* Don't pad beyond the total padding allowed.  */
@@ -16123,7 +16126,7 @@
 		    int bytepos, charpos;
 		    unsigned char *spec;
 
-		    bytepos = percent_position - lisp_string;
+		    bytepos = percent_position;
 		    charpos = (STRING_MULTIBYTE (elt)
 			       ? string_byte_to_char (elt, bytepos)
 			       : bytepos);
@@ -16181,8 +16184,6 @@
 		else /* c == 0 */
 		  break;
 	      }
-	    this += SDATA (elt) - lisp_string;
-	    lisp_string = SDATA (elt);
 	  }
       }
       break;