# HG changeset patch # User Kenichi Handa # Date 905220119 0 # Node ID 42fcd022d4e59ba72b0a9f9b14686e370719454b # Parent d7bd20e02b1dfeb23f39f3a776abff44bf8cb5f7 (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. diff -r d7bd20e02b1d -r 42fcd022d4e5 src/insdel.c --- a/src/insdel.c Tue Sep 08 02:01:59 1998 +0000 +++ b/src/insdel.c Tue Sep 08 02:01:59 1998 +0000 @@ -1636,13 +1636,16 @@ 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 @@ /* 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);