changeset 80833:08b58b8cda2b

(replace_range): For undo, record insertion first.
author Richard M. Stallman <rms@gnu.org>
date Sun, 29 Apr 2007 21:57:33 +0000
parents e712fac5ab3b
children dc554d19a7d3
files src/insdel.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/insdel.c	Sun Apr 29 21:11:42 2007 +0000
+++ b/src/insdel.c	Sun Apr 29 21:57:33 2007 +0000
@@ -1603,8 +1603,12 @@
 
   if (! EQ (current_buffer->undo_list, Qt))
     {
+      /* Record the insertion first, so that when we undo,
+	 the deletion will be undone first.  Thus, undo
+	 will insert before deleting, and thus will keep
+	 the markers before and after this text separate.  */
+      record_insert (from + SCHARS (deletion), inschars);
       record_delete (from, deletion);
-      record_insert (from, inschars);
     }
 
   GAP_SIZE -= outgoing_insbytes;