diff options
| author | Kenichi Handa | 1998-09-08 02:01:59 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-09-08 02:01:59 +0000 |
| commit | 8bedbe9dc24e2b2d170eaa4f23f7477f07d1ba75 (patch) | |
| tree | cb59d519a6225ca5a86e4ce7a695fcc6808a53f0 | |
| parent | 9869520f333b701cd2382511c067adeed09ad7eb (diff) | |
| download | emacs-8bedbe9dc24e2b2d170eaa4f23f7477f07d1ba75.tar.gz emacs-8bedbe9dc24e2b2d170eaa4f23f7477f07d1ba75.zip | |
(adjust_after_replace): Don't add combining bytes to
the args given to adjust_point. Handle correctly the case that
there are both before and after combining bytes.
(replace_range): Likewise.
| -rw-r--r-- | src/insdel.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/insdel.c b/src/insdel.c index 9a3aebfbc0a..d942da1f155 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1636,13 +1636,16 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte) | |||
| 1636 | int pos = PT, pos_byte = PT_BYTE; | 1636 | int pos = PT, pos_byte = PT_BYTE; |
| 1637 | 1637 | ||
| 1638 | if (from < PT) | 1638 | if (from < PT) |
| 1639 | adjust_point (len - nchars_del + combined_after_bytes, | 1639 | adjust_point (len - nchars_del, len_byte - nbytes_del); |
| 1640 | len_byte - nbytes_del + combined_after_bytes); | ||
| 1641 | else if (from == PT && combined_before_bytes) | ||
| 1642 | adjust_point (0, combined_before_bytes); | ||
| 1643 | 1640 | ||
| 1644 | if (combined_after_bytes) | 1641 | if (combined_after_bytes) |
| 1645 | combine_bytes (from + len, from_byte + len_byte, combined_after_bytes); | 1642 | { |
| 1643 | if (combined_before_bytes) | ||
| 1644 | combined_before_bytes += combined_after_bytes; | ||
| 1645 | else | ||
| 1646 | combine_bytes (from + len, from_byte + len_byte, | ||
| 1647 | combined_after_bytes); | ||
| 1648 | } | ||
| 1646 | 1649 | ||
| 1647 | if (combined_before_bytes) | 1650 | if (combined_before_bytes) |
| 1648 | combine_bytes (from, from_byte, combined_before_bytes); | 1651 | combine_bytes (from, from_byte, combined_before_bytes); |
| @@ -1887,16 +1890,18 @@ replace_range (from, to, new, prepare, inherit, markers) | |||
| 1887 | 1890 | ||
| 1888 | /* Relocate point as if it were a marker. */ | 1891 | /* Relocate point as if it were a marker. */ |
| 1889 | if (from < PT) | 1892 | if (from < PT) |
| 1890 | adjust_point ((from + inschars - (PT < to ? PT : to) | 1893 | adjust_point ((from + inschars - (PT < to ? PT : to)), |
| 1891 | + combined_after_bytes), | ||
| 1892 | (from_byte + outgoing_insbytes | 1894 | (from_byte + outgoing_insbytes |
| 1893 | - (PT_BYTE < to_byte ? PT_BYTE : to_byte) | 1895 | - (PT_BYTE < to_byte ? PT_BYTE : to_byte))); |
| 1894 | + combined_after_bytes)); | ||
| 1895 | 1896 | ||
| 1896 | if (combined_after_bytes) | 1897 | if (combined_after_bytes) |
| 1897 | combine_bytes (from + inschars, from_byte + outgoing_insbytes, | 1898 | { |
| 1898 | combined_after_bytes); | 1899 | if (combined_before_bytes) |
| 1899 | 1900 | combined_before_bytes += combined_after_bytes; | |
| 1901 | else | ||
| 1902 | combine_bytes (from + inschars, from_byte + outgoing_insbytes, | ||
| 1903 | combined_after_bytes); | ||
| 1904 | } | ||
| 1900 | if (combined_before_bytes) | 1905 | if (combined_before_bytes) |
| 1901 | combine_bytes (from, from_byte, combined_before_bytes); | 1906 | combine_bytes (from, from_byte, combined_before_bytes); |
| 1902 | 1907 | ||