diff options
| author | Eli Zaretskii | 2013-11-27 18:08:53 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-11-27 18:08:53 +0200 |
| commit | de1e0d91fe4f58aa35d8071966d978a70c349a08 (patch) | |
| tree | a37e0000ce66cdfdc5dd2959b58c9397f9f47dfb /src | |
| parent | fb6a5d68e3cbb993a9c72f0bf20e74951e873e72 (diff) | |
| download | emacs-de1e0d91fe4f58aa35d8071966d978a70c349a08.tar.gz emacs-de1e0d91fe4f58aa35d8071966d978a70c349a08.zip | |
Fix bug #15973 with erratic cursor motion after reverting a buffer.
src/fileio.c (Finsert_file_contents): Invalidate buffer caches when
deleting portions of the buffer under non-nil REPLACE argument.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/fileio.c | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b43f758cec4..89d1fb30774 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2013-11-27 Eli Zaretskii <eliz@gnu.org> | 1 | 2013-11-27 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * fileio.c (Finsert_file_contents): Invalidate buffer caches when | ||
| 4 | deleting portions of the buffer under non-nil REPLACE argument. | ||
| 5 | (Bug#15973) | ||
| 6 | |||
| 3 | * w32notify.c (Fw32notify_add_watch): If the argument FILE is a | 7 | * w32notify.c (Fw32notify_add_watch): If the argument FILE is a |
| 4 | directory, watch it and not its parent. | 8 | directory, watch it and not its parent. |
| 5 | (add_watch): Allow empty string in FILE. | 9 | (add_watch): Allow empty string in FILE. |
diff --git a/src/fileio.c b/src/fileio.c index 07d36016186..a0603b490d9 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3858,6 +3858,9 @@ by calling `format-decode', which see. */) | |||
| 3858 | beg_offset += same_at_start - BEGV_BYTE; | 3858 | beg_offset += same_at_start - BEGV_BYTE; |
| 3859 | end_offset -= ZV_BYTE - same_at_end; | 3859 | end_offset -= ZV_BYTE - same_at_end; |
| 3860 | 3860 | ||
| 3861 | invalidate_buffer_caches (current_buffer, | ||
| 3862 | BYTE_TO_CHAR (same_at_start), | ||
| 3863 | BYTE_TO_CHAR (same_at_end)); | ||
| 3861 | del_range_byte (same_at_start, same_at_end, 0); | 3864 | del_range_byte (same_at_start, same_at_end, 0); |
| 3862 | /* Insert from the file at the proper position. */ | 3865 | /* Insert from the file at the proper position. */ |
| 3863 | temp = BYTE_TO_CHAR (same_at_start); | 3866 | temp = BYTE_TO_CHAR (same_at_start); |
| @@ -3968,7 +3971,12 @@ by calling `format-decode', which see. */) | |||
| 3968 | { | 3971 | { |
| 3969 | /* Truncate the buffer to the size of the file. */ | 3972 | /* Truncate the buffer to the size of the file. */ |
| 3970 | if (same_at_start != same_at_end) | 3973 | if (same_at_start != same_at_end) |
| 3971 | del_range_byte (same_at_start, same_at_end, 0); | 3974 | { |
| 3975 | invalidate_buffer_caches (current_buffer, | ||
| 3976 | BYTE_TO_CHAR (same_at_start), | ||
| 3977 | BYTE_TO_CHAR (same_at_end)); | ||
| 3978 | del_range_byte (same_at_start, same_at_end, 0); | ||
| 3979 | } | ||
| 3972 | inserted = 0; | 3980 | inserted = 0; |
| 3973 | 3981 | ||
| 3974 | unbind_to (this_count, Qnil); | 3982 | unbind_to (this_count, Qnil); |
| @@ -4016,6 +4024,9 @@ by calling `format-decode', which see. */) | |||
| 4016 | 4024 | ||
| 4017 | if (same_at_end != same_at_start) | 4025 | if (same_at_end != same_at_start) |
| 4018 | { | 4026 | { |
| 4027 | invalidate_buffer_caches (current_buffer, | ||
| 4028 | BYTE_TO_CHAR (same_at_start), | ||
| 4029 | BYTE_TO_CHAR (same_at_end)); | ||
| 4019 | del_range_byte (same_at_start, same_at_end, 0); | 4030 | del_range_byte (same_at_start, same_at_end, 0); |
| 4020 | temp = GPT; | 4031 | temp = GPT; |
| 4021 | eassert (same_at_start == GPT_BYTE); | 4032 | eassert (same_at_start == GPT_BYTE); |