Mercurial > emacs
diff src/dispnew.c @ 111571:91de9477a77a
merge trunk
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 22 Sep 2010 15:46:51 +0900 |
parents | 9fa0b071facc |
children | 66f6be9b4d43 ee58b36ab139 |
line wrap: on
line diff
--- a/src/dispnew.c Wed Sep 08 12:55:57 2010 +0900 +++ b/src/dispnew.c Wed Sep 22 15:46:51 2010 +0900 @@ -5420,6 +5420,22 @@ if (STRINGP (it.string)) string = it.string; *pos = it.current; + if (it.what == IT_COMPOSITION + && it.cmp_it.nchars > 1 + && it.cmp_it.reversed_p) + { + /* The current display element is a grapheme cluster in a + composition. In that case, we need the position of the first + character of the cluster. But, as it.cmp_it.reversed_p is 1, + it.current points to the last character of the cluster, thus + we must move back to the first character of the same + cluster. */ + CHARPOS (pos->pos) -= it.cmp_it.nchars - 1; + if (STRINGP (it.string)) + BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); + else + BYTEPOS (pos->pos) = CHAR_TO_BYTE (CHARPOS (pos->pos)); + } #ifdef HAVE_WINDOW_SYSTEM if (it.what == IT_IMAGE)