From: Kenichi Handa Date: Mon, 7 Sep 1998 13:39:15 +0000 (+0000) Subject: (count_combining_after): Check also preceding bytes at X-Git-Tag: emacs-20.4~1746 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b57a7b0bf4da9bd1e48939778e597b772803b5a1;p=emacs.git (count_combining_after): Check also preceding bytes at POS if all characters in STRING are not character head. --- diff --git a/src/insdel.c b/src/insdel.c index fb29518fe89..9a3aebfbc0a 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -950,11 +950,23 @@ count_combining_after (string, length, pos, pos_byte) if (length == 0 || ASCII_BYTE_P (string[length - 1])) return 0; i = length - 1; - while (i > 0 && ! CHAR_HEAD_P (string[i])) + while (i >= 0 && ! CHAR_HEAD_P (string[i])) { i--; } - if (! BASE_LEADING_CODE_P (string[i])) + if (i < 0) + { + /* All characters in `string' are not character head. + We must check also preceding bytes at POS. + We are sure that the gap is at POS. */ + string = BEG_ADDR; + i = pos_byte - 2; + while (i >= 0 && ! CHAR_HEAD_P (string[i])) + i--; + if (i < 0 || !BASE_LEADING_CODE_P (string[i])) + return 0; + } + else if (!BASE_LEADING_CODE_P (string[i])) return 0; if (pos == ZV)