changeset 30379:836d2e058c70

(Fprevious_single_char_property_change): The initial property value should be from the position preceding POSITION, not following it.
author Miles Bader <miles@gnu.org>
date Sat, 22 Jul 2000 13:37:47 +0000
parents 54d7faf67340
children 4c605d08a747
files src/textprop.c
diffstat 1 files changed, 23 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/textprop.c	Sat Jul 22 13:36:08 2000 +0000
+++ b/src/textprop.c	Sat Jul 22 13:37:47 2000 +0000
@@ -769,7 +769,6 @@
     }
   else
     {
-      Lisp_Object initial_value, value;
       int count = specpdl_ptr - specpdl;
 
       if (! NILP (object))
@@ -786,19 +785,31 @@
       else
 	CHECK_NUMBER_COERCE_MARKER (limit, 0);
 
-      initial_value = Fget_char_property (position, prop, object);
-      
-      for (;;)
+      if (XFASTINT (position) <= XFASTINT (limit))
+	position = limit;
+      else
 	{
-	  position = Fprevious_char_property_change (position, limit);
-	  if (XFASTINT (position) <= XFASTINT (limit)) {
-	    position = limit;
-	    break;
-	  }
+	  Lisp_Object initial_value =
+	    Fget_char_property (position - 1, prop, object);
+      
+	  for (;;)
+	    {
+	      position = Fprevious_char_property_change (position, limit);
 
-	  value = Fget_char_property (position - 1, prop, object);
-	  if (!EQ (value, initial_value))
-	    break;
+	      if (XFASTINT (position) <= XFASTINT (limit))
+		{
+		  position = limit;
+		  break;
+		}
+	      else
+		{
+		  Lisp_Object value =
+		    Fget_char_property (position - 1, prop, object);
+
+		  if (!EQ (value, initial_value))
+		    break;
+		}
+	    }
 	}
 
       unbind_to (count, Qnil);