diff options
Diffstat (limited to 'src/insdel.c')
-rw-r--r-- | src/insdel.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/insdel.c b/src/insdel.c index d7ba13ecbc..c1c1ae882f 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1636,8 +1636,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; |