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)
#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)
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