From d279f62098be26a9e5ae55d02844d2e708e29e66 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Sat, 30 Dec 2000 02:29:22 +0000 Subject: [PATCH] (find_composition): Fix a code for searching a composition backward. --- src/ChangeLog | 4 ++-- src/composite.c | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 3facf78719a..7299bc4e399 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,7 @@ 2000-12-30 Kenichi Handa - * composite.c (find_composition): Fix a code for searching a - composition backward. + * composite.c (find_composition): Fix a code for searching + backward. 2000-12-29 Gerd Moellmann diff --git a/src/composite.c b/src/composite.c index 2ffc33d651e..83d5b0d6f25 100644 --- a/src/composite.c +++ b/src/composite.c @@ -422,14 +422,25 @@ find_composition (pos, limit, start, end, prop, object) 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; } -- 2.39.2