/* Search backward for a pattern that may be composed and the
position of (possibly) the last character of the match is
closest to (but not after) START. The reason for the last
- character is that set_iterator_to_next works in reverse order
- and, thus we must stop at the last character for composition
+ character is that set_iterator_to_next works in reverse order,
+ and thus we must stop at the last character for composition
check. */
unsigned char *p;
int len;
- /* limit byte position used in fast_looking_at. This is the
- byte position of the next character of START. */
+ /* Limit byte position used in fast_looking_at. This is the
+ byte position of the character after START. */
EMACS_INT limit;
if (NILP (string))
len = 1;
if (len > 0)
{
- /* Make CPOS points the last character of match.
+ /* Make CPOS point to the last character of match.
Note that LEN is byte-length. */
bpos += len;
if (NILP (string))
else if (! it->cmp_it.reversed_p)
{
/* Composition created while scanning forward. */
- /* Update IT's char/byte positions to point the first
+ /* Update IT's char/byte positions to point to the first
character of the next grapheme cluster, or to the
character visually after the current composition. */
-#if 0
- /* Is it ok to do this directly? */
- IT_CHARPOS (*it) += it->cmp_it.nchars;
- IT_BYTEPOS (*it) += it->cmp_it.nbytes;
-#else
- /* Or do we have to call bidi_get_next_char_visually
- repeatedly (perhaps not to confuse some internal
- state of bidi_it)? At least we must do this if we
- have consumed all grapheme clusters in the current
- composition because the next character will be in the
- different bidi level. */
for (i = 0; i < it->cmp_it.nchars; i++)
bidi_get_next_char_visually (&it->bidi_it);
- /* BTW, it seems that the name
- bidi_get_next_char_visually is confusing because
- it sounds like not advancing character position.
- How about bidi_set_iterator_to_next? */
IT_BYTEPOS (*it) = it->bidi_it.bytepos;
IT_CHARPOS (*it) = it->bidi_it.charpos;
-#endif
+
if (it->cmp_it.to < it->cmp_it.nglyphs)
{
/* Proceed to the next grapheme cluster. */
}
else
{
- /* No more grapheme cluster in this composition.
+ /* No more grapheme clusters in this composition.
Find the next stop position. */
EMACS_INT stop = it->stop_charpos;
if (it->bidi_it.scan_dir < 0)
else
{
/* Composition created while scanning backward. */
- /* Update IT's char/byte positions to point the last
+ /* Update IT's char/byte positions to point to the last
character of the previous grapheme cluster, or the
character visually after the current composition. */
bidi_get_next_char_visually (&it->bidi_it);
}
else
{
- /* No more grapheme cluster in this composition.
+ /* No more grapheme clusters in this composition.
Find the next stop position. */
EMACS_INT stop = it->stop_charpos;
if (it->bidi_it.scan_dir < 0)
IT_CHARPOS (*it) = it->bidi_it.charpos;
if (prev_scan_dir != it->bidi_it.scan_dir)
{
- /* As scan direction was changed, we must re-compute
- the stop position for composition. */
+ /* As the scan direction was changed, we must
+ re-compute the stop position for composition. */
EMACS_INT stop = it->stop_charpos;
if (it->bidi_it.scan_dir < 0)
stop = -1;