Mercurial > emacs
changeset 22753:4f555df67270
(Finsert_file_contents): When replacing, in multibyte bfr,
always extend the range to a character boundary.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 13 Jul 1998 22:11:54 +0000 |
parents | 00d24401ca1e |
children | 5102cb480cae |
files | src/fileio.c |
diffstat | 1 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fileio.c Mon Jul 13 22:04:35 1998 +0000 +++ b/src/fileio.c Mon Jul 13 22:11:54 1998 +0000 @@ -3698,7 +3698,14 @@ /* We win! We can handle REPLACE the optimized way. */ - /* Extends the end of non-matching text area to multibyte + /* Extend the start of non-matching text area to multibyte + character boundary. */ + if (! NILP (current_buffer->enable_multibyte_characters)) + while (same_at_start > BEGV_BYTE + && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) + same_at_start--; + + /* Extend the end of non-matching text area to multibyte character boundary. */ if (! NILP (current_buffer->enable_multibyte_characters)) while (same_at_end < ZV_BYTE @@ -3853,6 +3860,13 @@ goto handled; } + /* Extend the start of non-matching text area to multibyte + character boundary. */ + if (! NILP (current_buffer->enable_multibyte_characters)) + while (same_at_start > BEGV_BYTE + && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) + same_at_start--; + /* Scan this bufferful from the end, comparing with the Emacs buffer. */ bufpos = inserted; @@ -3863,6 +3877,13 @@ && FETCH_BYTE (same_at_end - 1) == conversion_buffer[bufpos - 1]) same_at_end--, bufpos--; + /* Extend the end of non-matching text area to multibyte + character boundary. */ + if (! NILP (current_buffer->enable_multibyte_characters)) + while (same_at_end < ZV_BYTE + && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) + same_at_end++; + /* Don't try to reuse the same piece of text twice. */ overlap = same_at_start - BEGV_BYTE - (same_at_end + inserted - ZV_BYTE); if (overlap > 0)