summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>1998-09-08 02:01:59 +0000
committerKenichi Handa <handa@m17n.org>1998-09-08 02:01:59 +0000
commit8bedbe9dc24e2b2d170eaa4f23f7477f07d1ba75 (patch)
treecb59d519a6225ca5a86e4ce7a695fcc6808a53f0
parent9869520f333b701cd2382511c067adeed09ad7eb (diff)
downloademacs-8bedbe9dc24e2b2d170eaa4f23f7477f07d1ba75.tar.gz
(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.c29
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)
int pos = PT, pos_byte = PT_BYTE;
if (from < PT)
- adjust_point (len - nchars_del + combined_after_bytes,
- len_byte - nbytes_del + combined_after_bytes);
- else if (from == PT && combined_before_bytes)
- adjust_point (0, combined_before_bytes);
+ adjust_point (len - nchars_del, len_byte - nbytes_del);
if (combined_after_bytes)
- combine_bytes (from + len, from_byte + len_byte, combined_after_bytes);
+ {
+ if (combined_before_bytes)
+ combined_before_bytes += combined_after_bytes;
+ else
+ combine_bytes (from + len, from_byte + len_byte,
+ combined_after_bytes);
+ }
if (combined_before_bytes)
combine_bytes (from, from_byte, combined_before_bytes);
@@ -1887,16 +1890,18 @@ replace_range (from, to, new, prepare, inherit, markers)
/* Relocate point as if it were a marker. */
if (from < PT)
- adjust_point ((from + inschars - (PT < to ? PT : to)
- + combined_after_bytes),
+ adjust_point ((from + inschars - (PT < to ? PT : to)),
(from_byte + outgoing_insbytes
- - (PT_BYTE < to_byte ? PT_BYTE : to_byte)
- + combined_after_bytes));
+ - (PT_BYTE < to_byte ? PT_BYTE : to_byte)));
if (combined_after_bytes)
- combine_bytes (from + inschars, from_byte + outgoing_insbytes,
- combined_after_bytes);
-
+ {
+ if (combined_before_bytes)
+ combined_before_bytes += combined_after_bytes;
+ else
+ combine_bytes (from + inschars, from_byte + outgoing_insbytes,
+ combined_after_bytes);
+ }
if (combined_before_bytes)
combine_bytes (from, from_byte, combined_before_bytes);