diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/insdel.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/insdel.c b/src/insdel.c index cc02c047663..2258f2c2ab9 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1004,8 +1004,7 @@ count_combining_after (string, length, pos, pos_byte) | |||
| 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) |
| @@ -1645,8 +1644,14 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte) | |||
| 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 | } |
| @@ -1896,8 +1901,14 @@ replace_range (from, to, new, prepare, inherit, markers) | |||
| 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 | ||