From: Gerd Moellmann Date: Mon, 27 Mar 2000 15:48:36 +0000 (+0000) Subject: (Fsubst_char_in_region): Don't use INC_POS in unibyte X-Git-Tag: emacs-pretest-21.0.90~4456 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7439e5b9ca61c98078e7dd51c8a4769fcf20377f;p=emacs.git (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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 285bbf211a0..0c4bf7ea82e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2000-03-27 Gerd Moellmann + * 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) diff --git a/src/editfns.c b/src/editfns.c index 4e25655f492..12db1a310dd 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -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