From: Eli Zaretskii Date: Fri, 14 May 2010 13:44:12 +0000 (+0300) Subject: Fix comments from 2010-05-14T04:14:23Z!handa@etlken. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~208^2~74 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d07f018c06e9666996af5813567ccf9540295c7b;p=emacs.git Fix comments from 2010-05-14T04:14:23Z!handa@etlken. --- diff --git a/src/composite.c b/src/composite.c index cbfb4aa66d3..f392053bac9 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1150,13 +1150,13 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) /* 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 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, 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)) diff --git a/src/xdisp.c b/src/xdisp.c index 16936b977fd..6375e03218a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -6307,29 +6307,14 @@ set_iterator_to_next (it, reseat_p) 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 @@ set_iterator_to_next (it, reseat_p) } 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 @@ set_iterator_to_next (it, reseat_p) 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 @@ set_iterator_to_next (it, reseat_p) } 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 @@ set_iterator_to_next (it, reseat_p) 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;