changeset 22896:6d368c9a689e

(replace_range): Don't assume PT is at the place where the change is being done.
author Richard M. Stallman <rms@gnu.org>
date Mon, 03 Aug 1998 22:25:54 +0000
parents 9f800ebc6091
children e694821e2b96
files src/insdel.c
diffstat 1 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/insdel.c	Mon Aug 03 22:25:08 1998 +0000
+++ b/src/insdel.c	Mon Aug 03 22:25:54 1998 +0000
@@ -1788,16 +1788,16 @@
 	     STRING_MULTIBYTE (new),
 	     ! NILP (current_buffer->enable_multibyte_characters));
 
-  /* We have copied text into the gap, but we have not altered
-     PT or PT_BYTE yet.  So we can pass PT and PT_BYTE
-     to these functions and get the same results as we would
-     have got earlier on.  Meanwhile, GPT_ADDR does point to
+  /* We have copied text into the gap, but we have not marked
+     it as part of the buffer.  So we can use the old FROM and FROM_BYTE
+     here, for both the previous text and the following text.
+     Meanwhile, GPT_ADDR does point to
      the text that has been stored by copy_text.  */
 
   combined_before_bytes
-    = count_combining_before (GPT_ADDR, outgoing_insbytes, PT, PT_BYTE);
+    = count_combining_before (GPT_ADDR, outgoing_insbytes, from, from_byte);
   combined_after_bytes
-    = count_combining_after (GPT_ADDR, outgoing_insbytes, PT, PT_BYTE);
+    = count_combining_after (GPT_ADDR, outgoing_insbytes, from, from_byte);
 
   /* Record deletion of the surrounding text that combines with
      the insertion.  This, together with recording the insertion,
@@ -1812,15 +1812,15 @@
       deletion = Qnil;
 
       if (! EQ (current_buffer->undo_list, Qt))
-	deletion = make_buffer_string_both (PT, PT_BYTE,
-					    PT + combined_after_bytes,
-					    PT_BYTE + combined_after_bytes, 1);
-
-      adjust_markers_for_record_delete (PT, PT_BYTE,
-					PT + combined_after_bytes,
-					PT_BYTE + combined_after_bytes);
+	deletion = make_buffer_string_both (from, from_byte,
+					    from + combined_after_bytes,
+					    from_byte + combined_after_bytes, 1);
+
+      adjust_markers_for_record_delete (from, from_byte,
+					from + combined_after_bytes,
+					from_byte + combined_after_bytes);
       if (! EQ (current_buffer->undo_list, Qt))
-	record_delete (PT, deletion);
+	record_delete (from, deletion);
     }
 
   if (combined_before_bytes)
@@ -1829,15 +1829,15 @@
       deletion = Qnil;
 
       if (! EQ (current_buffer->undo_list, Qt))
-	deletion = make_buffer_string_both (PT - 1, CHAR_TO_BYTE (PT - 1),
-					    PT, PT_BYTE, 1);
-      adjust_markers_for_record_delete (PT - 1, CHAR_TO_BYTE (PT - 1),
-					PT, PT_BYTE);
+	deletion = make_buffer_string_both (from - 1, CHAR_TO_BYTE (from - 1),
+					    from, from_byte, 1);
+      adjust_markers_for_record_delete (from - 1, CHAR_TO_BYTE (from - 1),
+					from, from_byte);
       if (! EQ (current_buffer->undo_list, Qt))
-	record_delete (PT - 1, deletion);
+	record_delete (from - 1, deletion);
     }
 
-  record_insert (PT - !!combined_before_bytes,
+  record_insert (from - !!combined_before_bytes,
 		 inschars - combined_before_bytes + !!combined_before_bytes);
 
   GAP_SIZE -= outgoing_insbytes;
@@ -1866,7 +1866,7 @@
 			       combined_before_bytes, combined_after_bytes, 0);
 
 #ifdef USE_TEXT_PROPERTIES
-  offset_intervals (current_buffer, PT, inschars - nchars_del);
+  offset_intervals (current_buffer, from, inschars - nchars_del);
 
   /* Get the intervals for the part of the string we are inserting--
      not including the combined-before bytes.  */
@@ -1899,7 +1899,7 @@
   MODIFF++;
   UNGCPRO;
 
-  signal_after_change (from, nchars_del, PT - from);
+  signal_after_change (from, nchars_del, GPT - from);
 }
 
 /* Delete characters in current buffer