2001-02-13 Gerd Moellmann <gerd@gnu.org>
+ * insdel.c (del_range_1, del_range_byte, del_range_both): Handle
+ case that TO ends up beyond ZV after running before-change-functions.
+
* window.c (window_loop) <GET_BUFFER_WINDOW>: Prefer to return
the selected window if it is showing the buffer in question.
{
int range_length = to - from;
prepare_to_modify_buffer (from, to, &from);
- to = from + range_length;
+ to = min (ZV, from + range_length);
}
from_byte = CHAR_TO_BYTE (from);
if (old_from != from)
from_byte = CHAR_TO_BYTE (from);
- if (old_to == Z - to)
+ if (to > ZV)
+ {
+ to = ZV;
+ to_byte = ZV_BYTE;
+ }
+ else if (old_to == Z - to)
to_byte = CHAR_TO_BYTE (to);
}
if (old_from != from)
from_byte = CHAR_TO_BYTE (from);
- if (old_to == Z - to)
+ if (to > ZV)
+ {
+ to = ZV;
+ to_byte = ZV_BYTE;
+ }
+ else if (old_to == Z - to)
to_byte = CHAR_TO_BYTE (to);
}