comparison src/insdel.c @ 36070:2a1ee495a194

(del_range_1, del_range_byte, del_range_both): Handle case that TO ends up beyond ZV after running before-change-functions.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 13 Feb 2001 16:28:36 +0000
parents 5bf4bcc0f936
children 2ae7cda73ec4
comparison
equal deleted inserted replaced
36069:c71ca27faca4 36070:2a1ee495a194
1550 1550
1551 if (prepare) 1551 if (prepare)
1552 { 1552 {
1553 int range_length = to - from; 1553 int range_length = to - from;
1554 prepare_to_modify_buffer (from, to, &from); 1554 prepare_to_modify_buffer (from, to, &from);
1555 to = from + range_length; 1555 to = min (ZV, from + range_length);
1556 } 1556 }
1557 1557
1558 from_byte = CHAR_TO_BYTE (from); 1558 from_byte = CHAR_TO_BYTE (from);
1559 to_byte = CHAR_TO_BYTE (to); 1559 to_byte = CHAR_TO_BYTE (to);
1560 1560
1593 prepare_to_modify_buffer (from, to, &from); 1593 prepare_to_modify_buffer (from, to, &from);
1594 to = from + range_length; 1594 to = from + range_length;
1595 1595
1596 if (old_from != from) 1596 if (old_from != from)
1597 from_byte = CHAR_TO_BYTE (from); 1597 from_byte = CHAR_TO_BYTE (from);
1598 if (old_to == Z - to) 1598 if (to > ZV)
1599 {
1600 to = ZV;
1601 to_byte = ZV_BYTE;
1602 }
1603 else if (old_to == Z - to)
1599 to_byte = CHAR_TO_BYTE (to); 1604 to_byte = CHAR_TO_BYTE (to);
1600 } 1605 }
1601 1606
1602 del_range_2 (from, from_byte, to, to_byte, 0); 1607 del_range_2 (from, from_byte, to, to_byte, 0);
1603 signal_after_change (from, to - from, 0); 1608 signal_after_change (from, to - from, 0);
1632 prepare_to_modify_buffer (from, to, &from); 1637 prepare_to_modify_buffer (from, to, &from);
1633 to = from + range_length; 1638 to = from + range_length;
1634 1639
1635 if (old_from != from) 1640 if (old_from != from)
1636 from_byte = CHAR_TO_BYTE (from); 1641 from_byte = CHAR_TO_BYTE (from);
1637 if (old_to == Z - to) 1642 if (to > ZV)
1643 {
1644 to = ZV;
1645 to_byte = ZV_BYTE;
1646 }
1647 else if (old_to == Z - to)
1638 to_byte = CHAR_TO_BYTE (to); 1648 to_byte = CHAR_TO_BYTE (to);
1639 } 1649 }
1640 1650
1641 del_range_2 (from, from_byte, to, to_byte, 0); 1651 del_range_2 (from, from_byte, to, to_byte, 0);
1642 signal_after_change (from, to - from, 0); 1652 signal_after_change (from, to - from, 0);