# HG changeset patch # User Gerd Moellmann # Date 982081716 0 # Node ID 2a1ee495a194b78be1bb8c3de8f3988ba37aa830 # Parent c71ca27faca41bb6022037d6b82bc15a7233f0a1 (del_range_1, del_range_byte, del_range_both): Handle case that TO ends up beyond ZV after running before-change-functions. diff -r c71ca27faca4 -r 2a1ee495a194 src/insdel.c --- a/src/insdel.c Tue Feb 13 15:44:58 2001 +0000 +++ b/src/insdel.c Tue Feb 13 16:28:36 2001 +0000 @@ -1552,7 +1552,7 @@ { 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); @@ -1595,7 +1595,12 @@ 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); } @@ -1634,7 +1639,12 @@ 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); }