comparison src/insdel.c @ 23555:7417378e7cce

(adjust_after_replace): Correctly handle the case that both byte combining before and byte combining after happen. (replace_range): Likewise.
author Kenichi Handa <handa@m17n.org>
date Tue, 27 Oct 1998 03:54:13 +0000
parents 84ad9e201361
children 25baa4bda79d
comparison
equal deleted inserted replaced
23554:e06e84c477fa 23555:7417378e7cce
1002 are located after position POS / POS_BYTE, and the preceding character 1002 are located after position POS / POS_BYTE, and the preceding character
1003 is located just before that position. 1003 is located just before that position.
1004 1004
1005 This function does not adjust markers for byte combining. That 1005 This function does not adjust markers for byte combining. That
1006 should be done in advance by the functions 1006 should be done in advance by the functions
1007 adjust_markers_for_insert, adjust_markers_for_delete, or 1007 adjust_markers_for_insert or adjust_markers_for_replace. */
1008 adjust_markers_for_replace. */
1009 1008
1010 static void 1009 static void
1011 combine_bytes (pos, pos_byte, nbytes) 1010 combine_bytes (pos, pos_byte, nbytes)
1012 int pos, pos_byte, nbytes; 1011 int pos, pos_byte, nbytes;
1013 { 1012 {
1643 1642
1644 if (from < PT) 1643 if (from < PT)
1645 adjust_point (len - nchars_del, len_byte - nbytes_del); 1644 adjust_point (len - nchars_del, len_byte - nbytes_del);
1646 1645
1647 if (combined_after_bytes) 1646 if (combined_after_bytes)
1648 combine_bytes (from + len, from_byte + len_byte, combined_after_bytes); 1647 {
1649 1648 if (combined_before_bytes == len_byte)
1649 /* This is the case that all new bytes are combined. */
1650 combined_before_bytes += combined_after_bytes;
1651 else
1652 combine_bytes (from + len, from_byte + len_byte,
1653 combined_after_bytes);
1654 }
1650 if (combined_before_bytes) 1655 if (combined_before_bytes)
1651 combine_bytes (from, from_byte, combined_before_bytes); 1656 combine_bytes (from, from_byte, combined_before_bytes);
1652 } 1657 }
1653 1658
1654 CHECK_MARKERS (); 1659 CHECK_MARKERS ();
1894 adjust_point ((from + inschars - (PT < to ? PT : to)), 1899 adjust_point ((from + inschars - (PT < to ? PT : to)),
1895 (from_byte + outgoing_insbytes 1900 (from_byte + outgoing_insbytes
1896 - (PT_BYTE < to_byte ? PT_BYTE : to_byte))); 1901 - (PT_BYTE < to_byte ? PT_BYTE : to_byte)));
1897 1902
1898 if (combined_after_bytes) 1903 if (combined_after_bytes)
1899 combine_bytes (from + inschars, from_byte + outgoing_insbytes, 1904 {
1900 combined_after_bytes); 1905 if (combined_before_bytes == outgoing_insbytes)
1906 /* This is the case that all new bytes are combined. */
1907 combined_before_bytes += combined_after_bytes;
1908 else
1909 combine_bytes (from + inschars, from_byte + outgoing_insbytes,
1910 combined_after_bytes);
1911 }
1901 if (combined_before_bytes) 1912 if (combined_before_bytes)
1902 combine_bytes (from, from_byte, combined_before_bytes); 1913 combine_bytes (from, from_byte, combined_before_bytes);
1903 1914
1904 if (outgoing_insbytes == 0) 1915 if (outgoing_insbytes == 0)
1905 evaporate_overlays (from); 1916 evaporate_overlays (from);