# HG changeset patch # User Kenichi Handa # Date 877926866 0 # Node ID d4ad4463384d05b579dc962ae2f938bb2487c1ba # Parent 0ee26e03e91167bb6ec14c7523e38ec619843ac1 (Fchars_in_string): Pay attention to enable-multibyte-characters. (Fchars_in_region): Likewise. Avoid error when the region ends in the middle of a multibyte character. diff -r 0ee26e03e911 -r d4ad4463384d src/charset.c --- a/src/charset.c Mon Oct 27 03:53:24 1997 +0000 +++ b/src/charset.c Mon Oct 27 04:34:26 1997 +0000 @@ -945,6 +945,9 @@ CHECK_STRING (str, 0); + if (NILP (current_buffer->enable_multibyte_characters)) + return make_number (XSTRING (str)->size); + p = XSTRING (str)->data; endp = p + XSTRING (str)->size; chars = 0; while (p < endp) @@ -982,6 +985,9 @@ to = max (XFASTINT (beg), XFASTINT (end)); p = POS_ADDR (from); + if (NILP (current_buffer->enable_multibyte_characters)) + return make_number (to - from); + if (from < GPT && GPT <= to) { stop = GPT; @@ -995,9 +1001,9 @@ while (1) { - if (p == endp) + if (p >= endp) { - if (stop == to) + if (stop >= to) break; p = POS_ADDR (stop);