changeset 79101:f79e08d5ee4e

(handle_display_prop): Ignore display specs after replacing one when string text is being replaced. (handle_single_display_spec): Pretend as if characters with display property haven't been consumed only when buffer text is being replaced.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Tue, 16 Oct 2007 08:59:25 +0000
parents 679f39df8305
children 658e15fbbe35
files src/xdisp.c
diffstat 1 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Tue Oct 16 02:34:58 2007 +0000
+++ b/src/xdisp.c	Tue Oct 16 08:59:25 2007 +0000
@@ -3839,7 +3839,13 @@
 	{
 	  if (handle_single_display_spec (it, XCAR (prop), object,
 					  position, display_replaced_p))
-	    display_replaced_p = 1;
+	    {
+	      display_replaced_p = 1;
+	      /* If some text in a string is replaced, `position' no
+		 longer points to the position of `object'.  */
+	      if (STRINGP (object))
+		break;
+	    }
 	}
     }
   else if (VECTORP (prop))
@@ -3848,7 +3854,13 @@
       for (i = 0; i < ASIZE (prop); ++i)
 	if (handle_single_display_spec (it, AREF (prop, i), object,
 					position, display_replaced_p))
-	  display_replaced_p = 1;
+	  {
+	    display_replaced_p = 1;
+	    /* If some text in a string is replaced, `position' no
+	       longer points to the position of `object'.  */
+	    if (STRINGP (object))
+	      break;
+	  }
     }
   else
     {
@@ -4237,13 +4249,16 @@
 	  /* Say that we haven't consumed the characters with
 	     `display' property yet.  The call to pop_it in
 	     set_iterator_to_next will clean this up.  */
-	  *position = start_pos;
+	  if (BUFFERP (object))
+	    it->current.pos = start_pos;
 	}
       else if (CONSP (value) && EQ (XCAR (value), Qspace))
 	{
 	  it->method = GET_FROM_STRETCH;
 	  it->object = value;
-	  *position = it->position = start_pos;
+	  it->position = start_pos;
+	  if (BUFFERP (object))
+	    it->current.pos = start_pos;
 	}
 #ifdef HAVE_WINDOW_SYSTEM
       else
@@ -4257,7 +4272,8 @@
 	  /* Say that we haven't consumed the characters with
 	     `display' property yet.  The call to pop_it in
 	     set_iterator_to_next will clean this up.  */
-	  *position = start_pos;
+	  if (BUFFERP (object))
+	    it->current.pos = start_pos;
 	}
 #endif /* HAVE_WINDOW_SYSTEM */