diff options
| author | Richard M. Stallman | 2007-04-29 21:57:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-04-29 21:57:33 +0000 |
| commit | bec1aca2ee97c2b4c61dc6e1b00b1653f4f5a8c7 (patch) | |
| tree | 3709773db1e041ab38773e3d990f08b9aebf89aa /src | |
| parent | 2ad08150952f3d3cc7212dec97fb330fa5c3f778 (diff) | |
| download | emacs-bec1aca2ee97c2b4c61dc6e1b00b1653f4f5a8c7.tar.gz emacs-bec1aca2ee97c2b4c61dc6e1b00b1653f4f5a8c7.zip | |
(replace_range): For undo, record insertion first.
Diffstat (limited to 'src')
| -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 7f15f7de52d..65d60b6b8e3 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1603,8 +1603,12 @@ replace_range (from, to, new, prepare, inherit, markers) | |||
| 1603 | 1603 | ||
| 1604 | if (! EQ (current_buffer->undo_list, Qt)) | 1604 | if (! EQ (current_buffer->undo_list, Qt)) |
| 1605 | { | 1605 | { |
| 1606 | /* Record the insertion first, so that when we undo, | ||
| 1607 | the deletion will be undone first. Thus, undo | ||
| 1608 | will insert before deleting, and thus will keep | ||
| 1609 | the markers before and after this text separate. */ | ||
| 1610 | record_insert (from + SCHARS (deletion), inschars); | ||
| 1606 | record_delete (from, deletion); | 1611 | record_delete (from, deletion); |
| 1607 | record_insert (from, inschars); | ||
| 1608 | } | 1612 | } |
| 1609 | 1613 | ||
| 1610 | GAP_SIZE -= outgoing_insbytes; | 1614 | GAP_SIZE -= outgoing_insbytes; |