]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fsubst_char_in_region): Don't use INC_POS in unibyte
authorGerd Moellmann <gerd@gnu.org>
Mon, 27 Mar 2000 15:48:36 +0000 (15:48 +0000)
committerGerd Moellmann <gerd@gnu.org>
Mon, 27 Mar 2000 15:48:36 +0000 (15:48 +0000)
buffers because it looks for multibyte character sequences which
don't exist in unibyte text.

src/ChangeLog
src/editfns.c

index 285bbf211a09b5dc04c584fef97a91fb51b60751..0c4bf7ea82ee4f6e8d06b34b1ddcd1681512cbc9 100644 (file)
@@ -1,5 +1,9 @@
 2000-03-27  Gerd Moellmann  <gerd@gnu.org>
 
+       * editfns.c (Fsubst_char_in_region): Don't use INC_POS in unibyte
+       buffers because it looks for multibyte character sequences which
+       don't exist in unibyte text.
+
        * xterm.h (x_specified_cursor_type, x_copy_color): Add prototypes.
 
        * xfaces.c (register_color, unregister_colors, unregister_colors)
index 4e25655f492e5602069b4f9cabb220e9a05448f1..12db1a310dd4356ce0eddf2f176babab824c7f79 100644 (file)
@@ -2280,12 +2280,13 @@ Both characters must have the same length of multi-byte form.")
 #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
   int maybe_byte_combining = COMBINING_NO;
   int last_changed;
+  int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
 
   validate_region (&start, &end);
   CHECK_NUMBER (fromchar, 2);
   CHECK_NUMBER (tochar, 3);
 
-  if (! NILP (current_buffer->enable_multibyte_characters))
+  if (multibyte_p)
     {
       len = CHAR_STRING (XFASTINT (fromchar), fromstr);
       if (CHAR_STRING (XFASTINT (tochar), tostr) != len)
@@ -2341,7 +2342,10 @@ Both characters must have the same length of multi-byte form.")
          stop = end_byte;
        }
       p = BYTE_POS_ADDR (pos_byte);
-      INC_POS (pos_byte_next);
+      if (multibyte_p)
+       INC_POS (pos_byte_next);
+      else
+       ++pos_byte_next;
       if (pos_byte_next - pos_byte == len
          && p[0] == fromstr[0]
          && (len == 1