aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1999-06-22 23:25:16 +0000
committerKenichi Handa1999-06-22 23:25:16 +0000
commit427f5aab9d1831bbb16fa051a4210a85fdccc406 (patch)
tree51e6dbd47dfb2b65ceeda68d54da6a716ac17e6d /src
parent3f66fcdb622c0ed8408b45ed04320df7c7b2c4fc (diff)
downloademacs-427f5aab9d1831bbb16fa051a4210a85fdccc406.tar.gz
emacs-427f5aab9d1831bbb16fa051a4210a85fdccc406.zip
(Finsert_file_contents): In the case of REPALCE, call
del_range_byte instead off del_range_1, set `inserted' to the number of characters actually inserted.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/fileio.c b/src/fileio.c
index f5371e6ee38..893073d9cd7 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3863,7 +3863,8 @@ actually used.")
3863 close (fd); 3863 close (fd);
3864 specpdl_ptr--; 3864 specpdl_ptr--;
3865 /* Truncate the buffer to the size of the file. */ 3865 /* Truncate the buffer to the size of the file. */
3866 del_range_1 (same_at_start, same_at_end, 0); 3866 del_range_byte (same_at_start, same_at_end, 0);
3867 inserted = 0;
3867 goto handled; 3868 goto handled;
3868 } 3869 }
3869 3870
@@ -3905,18 +3906,23 @@ actually used.")
3905 and update INSERTED to equal the number of bytes 3906 and update INSERTED to equal the number of bytes
3906 we are taking from the file. */ 3907 we are taking from the file. */
3907 inserted -= (Z_BYTE - same_at_end) + (same_at_start - BEG_BYTE); 3908 inserted -= (Z_BYTE - same_at_end) + (same_at_start - BEG_BYTE);
3908 del_range_byte (same_at_start, same_at_end, 0); 3909
3909 if (same_at_end != same_at_start) 3910 if (same_at_end != same_at_start)
3910 SET_PT_BOTH (GPT, GPT_BYTE); 3911 {
3912 del_range_byte (same_at_start, same_at_end, 0);
3913 temp = GPT;
3914 same_at_start = GPT_BYTE;
3915 }
3911 else 3916 else
3912 { 3917 {
3913 /* Insert from the file at the proper position. */
3914 temp = BYTE_TO_CHAR (same_at_start); 3918 temp = BYTE_TO_CHAR (same_at_start);
3915 SET_PT_BOTH (temp, same_at_start);
3916 } 3919 }
3917 3920 /* Insert from the file at the proper position. */
3921 SET_PT_BOTH (temp, same_at_start);
3918 insert_1 (conversion_buffer + same_at_start - BEG_BYTE, inserted, 3922 insert_1 (conversion_buffer + same_at_start - BEG_BYTE, inserted,
3919 0, 0, 0); 3923 0, 0, 0);
3924 /* Set `inserted' to the number of inserted characters. */
3925 inserted = PT - temp;
3920 3926
3921 free (conversion_buffer); 3927 free (conversion_buffer);
3922 close (fd); 3928 close (fd);