Commit de1e0d91 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent fb6a5d68
2013-11-27 Eli Zaretskii <eliz@gnu.org> 2013-11-27 Eli Zaretskii <eliz@gnu.org>
* fileio.c (Finsert_file_contents): Invalidate buffer caches when
deleting portions of the buffer under non-nil REPLACE argument.
(Bug#15973)
* w32notify.c (Fw32notify_add_watch): If the argument FILE is a * w32notify.c (Fw32notify_add_watch): If the argument FILE is a
directory, watch it and not its parent. directory, watch it and not its parent.
(add_watch): Allow empty string in FILE. (add_watch): Allow empty string in FILE.
......
...@@ -3858,6 +3858,9 @@ by calling `format-decode', which see. */) ...@@ -3858,6 +3858,9 @@ by calling `format-decode', which see. */)
beg_offset += same_at_start - BEGV_BYTE; beg_offset += same_at_start - BEGV_BYTE;
end_offset -= ZV_BYTE - same_at_end; end_offset -= ZV_BYTE - same_at_end;
invalidate_buffer_caches (current_buffer,
BYTE_TO_CHAR (same_at_start),
BYTE_TO_CHAR (same_at_end));
del_range_byte (same_at_start, same_at_end, 0); del_range_byte (same_at_start, same_at_end, 0);
/* Insert from the file at the proper position. */ /* Insert from the file at the proper position. */
temp = BYTE_TO_CHAR (same_at_start); temp = BYTE_TO_CHAR (same_at_start);
...@@ -3968,7 +3971,12 @@ by calling `format-decode', which see. */) ...@@ -3968,7 +3971,12 @@ by calling `format-decode', which see. */)
{ {
/* Truncate the buffer to the size of the file. */ /* Truncate the buffer to the size of the file. */
if (same_at_start != same_at_end) if (same_at_start != same_at_end)
{
invalidate_buffer_caches (current_buffer,
BYTE_TO_CHAR (same_at_start),
BYTE_TO_CHAR (same_at_end));
del_range_byte (same_at_start, same_at_end, 0); del_range_byte (same_at_start, same_at_end, 0);
}
inserted = 0; inserted = 0;
unbind_to (this_count, Qnil); unbind_to (this_count, Qnil);
...@@ -4016,6 +4024,9 @@ by calling `format-decode', which see. */) ...@@ -4016,6 +4024,9 @@ by calling `format-decode', which see. */)
if (same_at_end != same_at_start) if (same_at_end != same_at_start)
{ {
invalidate_buffer_caches (current_buffer,
BYTE_TO_CHAR (same_at_start),
BYTE_TO_CHAR (same_at_end));
del_range_byte (same_at_start, same_at_end, 0); del_range_byte (same_at_start, same_at_end, 0);
temp = GPT; temp = GPT;
eassert (same_at_start == GPT_BYTE); eassert (same_at_start == GPT_BYTE);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment