]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fchars_in_string): Pay attention to
authorKenichi Handa <handa@m17n.org>
Mon, 27 Oct 1997 04:34:26 +0000 (04:34 +0000)
committerKenichi Handa <handa@m17n.org>
Mon, 27 Oct 1997 04:34:26 +0000 (04:34 +0000)
enable-multibyte-characters.
(Fchars_in_region): Likewise.  Avoid error when the region ends in
the middle of a multibyte character.

src/charset.c

index 7d8716e134e5dd1b9da24be87b1dbf1f6939b8b8..56dc15e78dacbd77c2ad4a82195013374e352f51 100644 (file)
@@ -945,6 +945,9 @@ character.")
 
   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 @@ may be more than the number of characters.")
   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 @@ may be more than the number of characters.")
 
   while (1)
     {
-      if (p == endp)
+      if (p >= endp)
        {
-         if (stop == to)
+         if (stop >= to)
            break;
 
          p = POS_ADDR (stop);