From: Richard M. Stallman Date: Sun, 29 Apr 2007 21:56:23 +0000 (+0000) Subject: (replace_range): For undo, record insertion first. X-Git-Tag: emacs-pretest-22.0.990~106 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=00993b140ddbef85334b18bf3e954d9d77c5173e;p=emacs.git (replace_range): For undo, record insertion first. --- diff --git a/src/insdel.c b/src/insdel.c index 7f15f7de52d..65d60b6b8e3 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1603,8 +1603,12 @@ replace_range (from, to, new, prepare, inherit, markers) 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;