]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fbase64_decode_region): Fix previous change.
authorKenichi Handa <handa@m17n.org>
Sat, 31 Oct 1998 05:12:07 +0000 (05:12 +0000)
committerKenichi Handa <handa@m17n.org>
Sat, 31 Oct 1998 05:12:07 +0000 (05:12 +0000)
n

src/fns.c

index c60303acec62af96ecc05f39e4153c0cf0ee207d..0c24f7a4e3f4b14476dffb1fbfd37d1766bce488 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -2990,15 +2990,20 @@ If the region can't be decoded, return nil and don't modify the buffer.")
      and delete the old.  (Insert first in order to preserve markers.)  */
   /* We insert two spaces, then insert the decoded text in between
      them, at last, delete those extra two spaces.  This is to avoid
-     byte combining.  */
+     byte combining while inserting.  */
   TEMP_SET_PT_BOTH (XFASTINT (beg), ibeg);
   insert_1_both ("  ", 2, 2, 0, 1, 0);
   TEMP_SET_PT_BOTH (XFASTINT (beg) + 1, ibeg + 1);  
   insert (decoded, decoded_length);
   inserted_chars = PT - (XFASTINT (beg) + 1);
-  del_range_both (PT, PT_BYTE, XFASTINT (end) + inserted_chars + 2,
+  /* At first delete the original text.  This never cause byte
+     combining.  */
+  del_range_both (PT + 1, PT_BYTE + 1, XFASTINT (end) + inserted_chars + 2,
                  iend + decoded_length + 2, 1);
-  del_range_both (XFASTINT (beg), ibeg, XFASTINT (beg) + 1, ibeg + 1, 1);
+  /* Next delete the extra spaces.  This will cause byte combining
+     error.  */
+  del_range_both (PT, PT_BYTE, PT + 1, PT_BYTE + 1, 0);
+  del_range_both (XFASTINT (beg), ibeg, XFASTINT (beg) + 1, ibeg + 1, 0);
   inserted_chars = PT - XFASTINT (beg);
 
   /* If point was outside of the region, restore it exactly; else just