# HG changeset patch # User Kenichi Handa # Date 890027467 0 # Node ID 14e52c1a5d68f7e53a47bc0a898c18af2a2d04bc # Parent 607ce9d7cf53af14b4ce42287f637fe004214c9f (Finsert_file_contents): Comment modified. Give adjust_after_replace the new arg REPLACE as 0. diff -r 607ce9d7cf53 -r 14e52c1a5d68 src/fileio.c --- a/src/fileio.c Mon Mar 16 04:10:19 1998 +0000 +++ b/src/fileio.c Mon Mar 16 05:51:07 1998 +0000 @@ -3771,6 +3771,9 @@ { if (CODING_MAY_REQUIRE_DECODING (&coding)) { + /* Here, we don't have to consider byte combining (see the + comment below) because code_convert_region takes care of + it. */ code_convert_region (PT, PT_BYTE, PT + inserted, PT_BYTE + inserted, &coding, 0, 0); inserted = (NILP (current_buffer->enable_multibyte_characters) @@ -3780,8 +3783,11 @@ { int inserted_byte = inserted; - /* At first, reset positions to the state of before - insertion. */ + /* There's a possibility that we must combine bytes at the + head (resp. the tail) of the just inserted text with the + bytes before (resp. after) the gap to form a single + character. Thus, we, at first, rewind the adjusted + character positions (GPT, ZV, Z), then adjust them again. */ GAP_SIZE += inserted; GPT_BYTE -= inserted; ZV_BYTE -= inserted; @@ -3790,10 +3796,9 @@ ZV -= inserted; Z -= inserted; - /* Then adjust positions. */ inserted = multibyte_chars_in_text (GPT_ADDR, inserted); adjust_after_replace (PT, PT_BYTE, PT, PT_BYTE, - inserted, inserted_byte); + inserted, inserted_byte, 0); } #ifdef DOS_NT