# HG changeset patch # User Eli Zaretskii # Date 1273844652 -10800 # Node ID dce075eda1bf1ded9eb7ea9b2b599ced5c495602 # Parent 6e7ebe021a2c89d606f36b271aaafb01bb2b9761 Fix comments from revno 100276. diff -r 6e7ebe021a2c -r dce075eda1bf src/composite.c --- a/src/composite.c Fri May 14 15:31:36 2010 +0200 +++ b/src/composite.c Fri May 14 16:44:12 2010 +0300 @@ -1150,13 +1150,13 @@ /* 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)) @@ -1191,7 +1191,7 @@ 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)) diff -r 6e7ebe021a2c -r dce075eda1bf src/xdisp.c --- a/src/xdisp.c Fri May 14 15:31:36 2010 +0200 +++ b/src/xdisp.c Fri May 14 16:44:12 2010 +0300 @@ -6307,29 +6307,14 @@ 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. */ @@ -6337,7 +6322,7 @@ } 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) @@ -6351,7 +6336,7 @@ 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); @@ -6365,7 +6350,7 @@ } 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) @@ -6398,8 +6383,8 @@ 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;