diff options
| author | Kenichi Handa | 1997-10-27 04:34:26 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-10-27 04:34:26 +0000 |
| commit | 9036eb4502cc763993b219fcb74b546a2b5ab999 (patch) | |
| tree | c11f453d3019af6df4332e1c1ddbb5a189a2cddb /src | |
| parent | c7c5bbc0b88cd3dd56ae3ebe0beee5ab33e277eb (diff) | |
| download | emacs-9036eb4502cc763993b219fcb74b546a2b5ab999.tar.gz emacs-9036eb4502cc763993b219fcb74b546a2b5ab999.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/charset.c b/src/charset.c index 7d8716e134e..56dc15e78da 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -945,6 +945,9 @@ character.") | |||
| 945 | 945 | ||
| 946 | CHECK_STRING (str, 0); | 946 | CHECK_STRING (str, 0); |
| 947 | 947 | ||
| 948 | if (NILP (current_buffer->enable_multibyte_characters)) | ||
| 949 | return make_number (XSTRING (str)->size); | ||
| 950 | |||
| 948 | p = XSTRING (str)->data; endp = p + XSTRING (str)->size; | 951 | p = XSTRING (str)->data; endp = p + XSTRING (str)->size; |
| 949 | chars = 0; | 952 | chars = 0; |
| 950 | while (p < endp) | 953 | while (p < endp) |
| @@ -982,6 +985,9 @@ may be more than the number of characters.") | |||
| 982 | to = max (XFASTINT (beg), XFASTINT (end)); | 985 | to = max (XFASTINT (beg), XFASTINT (end)); |
| 983 | p = POS_ADDR (from); | 986 | p = POS_ADDR (from); |
| 984 | 987 | ||
| 988 | if (NILP (current_buffer->enable_multibyte_characters)) | ||
| 989 | return make_number (to - from); | ||
| 990 | |||
| 985 | if (from < GPT && GPT <= to) | 991 | if (from < GPT && GPT <= to) |
| 986 | { | 992 | { |
| 987 | stop = GPT; | 993 | stop = GPT; |
| @@ -995,9 +1001,9 @@ may be more than the number of characters.") | |||
| 995 | 1001 | ||
| 996 | while (1) | 1002 | while (1) |
| 997 | { | 1003 | { |
| 998 | if (p == endp) | 1004 | if (p >= endp) |
| 999 | { | 1005 | { |
| 1000 | if (stop == to) | 1006 | if (stop >= to) |
| 1001 | break; | 1007 | break; |
| 1002 | 1008 | ||
| 1003 | p = POS_ADDR (stop); | 1009 | p = POS_ADDR (stop); |