- BACKWARD_CHAR (cur, stop);
- if (get_property_and_range (cur.pos, Qcomposition, &val, &b, &e, Qnil)
- && COMPOSITION_VALID_P (b, e, val))
- break;
+ Here, it is known that characters after positions 1 and 9 can
+ never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and
+ composition A is an invalid one because it's partially covered by
+ the valid composition C. And to know whether a composition is
+ valid or not, the only way is to start searching forward from a
+ position that can not be a tail part of composition (it's 2 in
+ the above case).
+
+ Now we have these cases (1 through 4):
+
+ -- character after POS is ... --
+ not composable composable
+ LIMIT <= POS (1) (3)
+ POS < LIMIT (2) (4)
+
+ Among them, in case (2), we simply search forward from POS.
+
+ In the other cases, we at first rewind back to the position where
+ the previous character is not composable or the beginning of
+ buffer (string), then search compositions forward. In case (1)
+ and (3) we repeat this process until a composition is found. */
+
+ while (1)
+ {