From 3f5409d35bb98c63ce460bac3ca41a8377a49f36 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 28 Oct 1998 07:52:13 +0000 Subject: [PATCH] (Fsubst_char_in_region): Fix previous change. (Ftranslate_region): Fix previous change. --- src/editfns.c | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/src/editfns.c b/src/editfns.c index b6302ca05f2..67758db088b 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2042,13 +2042,11 @@ Both characters must have the same length of multi-byte form.") pos_byte_next = CHAR_TO_BYTE (pos); if (pos_byte_next > pos_byte) /* Before combining happened. We should not increment - POS because now it points the next character. */ - pos_byte = pos_byte_next; + POS. So, to cancel the later increment of POS, + decrease it now. */ + pos--; else - { - pos++; - INC_POS (pos_byte_next); - } + INC_POS (pos_byte_next); if (! NILP (noundo)) current_buffer->undo_list = tem; @@ -2060,15 +2058,10 @@ Both characters must have the same length of multi-byte form.") if (NILP (noundo)) record_change (pos, 1); for (i = 0; i < len; i++) *p++ = tostr[i]; - pos_byte = pos_byte_next; - pos++; } } - else - { - pos_byte = pos_byte_next; - pos++; - } + pos_byte = pos_byte_next; + pos++; } if (changed) @@ -2141,36 +2134,23 @@ It returns the number of characters changed.") pos_byte_next = CHAR_TO_BYTE (pos); if (pos_byte_next > pos_byte) /* Before combining happened. We should not - increment POS because now it points the next - character. */ - pos_byte = pos_byte_next; + increment POS. So, to cancel the later + increment of POS, we decrease it now. */ + pos--; else - { - pos++; - INC_POS (pos_byte_next); - } + INC_POS (pos_byte_next); } else { record_change (pos, 1); *p = nc; signal_after_change (pos, 1, 1); - pos_byte++; - pos++; } ++cnt; } - else - { - pos_byte++; - pos++; - } - } - else - { - pos_byte += len; - pos++; } + pos_byte = pos_byte_next; + pos++; } return make_number (cnt); -- 2.39.2