changeset 34933:414310d24f52

(find_composition): Fix a code for searching a composition backward.
author Kenichi Handa <handa@m17n.org>
date Sat, 30 Dec 2000 02:28:42 +0000
parents ddf283b46fe8
children 32348df5a438
files src/composite.c
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/composite.c	Sat Dec 30 02:28:28 2000 +0000
+++ b/src/composite.c	Sat Dec 30 02:28:42 2000 +0000
@@ -422,14 +422,25 @@
     return 0;
 
   if (limit > pos)		/* search forward */
-    val = Fnext_single_property_change (make_number (pos), Qcomposition,
-					object, make_number (limit));
+    {
+      val = Fnext_single_property_change (make_number (pos), Qcomposition,
+					  object, make_number (limit));
+      pos = XINT (val);
+      if (pos == limit)
+	return 0;
+    }
   else				/* search backward */
-    val = Fprevious_single_property_change (make_number (pos), Qcomposition,
-					    object, make_number (limit));
-  pos = XINT (val);
-  if (pos == limit)
-    return 0;
+    {
+      if (get_property_and_range (pos - 1, Qcomposition, prop, start, end,
+				  object))
+	return 1;
+      val = Fprevious_single_property_change (make_number (pos), Qcomposition,
+					      object, make_number (limit));
+      pos = XINT (val);
+      if (pos == limit)
+	return 0;
+      pos--;
+    }
   get_property_and_range (pos, Qcomposition, prop, start, end, object);
   return 1;
 }