diff options
| author | Richard M. Stallman | 1998-07-13 22:11:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-07-13 22:11:54 +0000 |
| commit | 20f6783d3c7efe13beda2f1531ddfe71dfaa1d22 (patch) | |
| tree | d78311d4810a673cde4b7107b879aaca21dcad5d /src | |
| parent | 7c968ca53e3a9a84cb152ad2231e98ae2462009d (diff) | |
| download | emacs-20f6783d3c7efe13beda2f1531ddfe71dfaa1d22.tar.gz emacs-20f6783d3c7efe13beda2f1531ddfe71dfaa1d22.zip | |
(Finsert_file_contents): When replacing, in multibyte bfr,
always extend the range to a character boundary.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index e444b1474d2..e3ca6cd4e2a 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3698,7 +3698,14 @@ actually used.") | |||
| 3698 | 3698 | ||
| 3699 | /* We win! We can handle REPLACE the optimized way. */ | 3699 | /* We win! We can handle REPLACE the optimized way. */ |
| 3700 | 3700 | ||
| 3701 | /* Extends the end of non-matching text area to multibyte | 3701 | /* Extend the start of non-matching text area to multibyte |
| 3702 | character boundary. */ | ||
| 3703 | if (! NILP (current_buffer->enable_multibyte_characters)) | ||
| 3704 | while (same_at_start > BEGV_BYTE | ||
| 3705 | && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) | ||
| 3706 | same_at_start--; | ||
| 3707 | |||
| 3708 | /* Extend the end of non-matching text area to multibyte | ||
| 3702 | character boundary. */ | 3709 | character boundary. */ |
| 3703 | if (! NILP (current_buffer->enable_multibyte_characters)) | 3710 | if (! NILP (current_buffer->enable_multibyte_characters)) |
| 3704 | while (same_at_end < ZV_BYTE | 3711 | while (same_at_end < ZV_BYTE |
| @@ -3853,6 +3860,13 @@ actually used.") | |||
| 3853 | goto handled; | 3860 | goto handled; |
| 3854 | } | 3861 | } |
| 3855 | 3862 | ||
| 3863 | /* Extend the start of non-matching text area to multibyte | ||
| 3864 | character boundary. */ | ||
| 3865 | if (! NILP (current_buffer->enable_multibyte_characters)) | ||
| 3866 | while (same_at_start > BEGV_BYTE | ||
| 3867 | && ! CHAR_HEAD_P (FETCH_BYTE (same_at_start))) | ||
| 3868 | same_at_start--; | ||
| 3869 | |||
| 3856 | /* Scan this bufferful from the end, comparing with | 3870 | /* Scan this bufferful from the end, comparing with |
| 3857 | the Emacs buffer. */ | 3871 | the Emacs buffer. */ |
| 3858 | bufpos = inserted; | 3872 | bufpos = inserted; |
| @@ -3863,6 +3877,13 @@ actually used.") | |||
| 3863 | && FETCH_BYTE (same_at_end - 1) == conversion_buffer[bufpos - 1]) | 3877 | && FETCH_BYTE (same_at_end - 1) == conversion_buffer[bufpos - 1]) |
| 3864 | same_at_end--, bufpos--; | 3878 | same_at_end--, bufpos--; |
| 3865 | 3879 | ||
| 3880 | /* Extend the end of non-matching text area to multibyte | ||
| 3881 | character boundary. */ | ||
| 3882 | if (! NILP (current_buffer->enable_multibyte_characters)) | ||
| 3883 | while (same_at_end < ZV_BYTE | ||
| 3884 | && ! CHAR_HEAD_P (FETCH_BYTE (same_at_end))) | ||
| 3885 | same_at_end++; | ||
| 3886 | |||
| 3866 | /* Don't try to reuse the same piece of text twice. */ | 3887 | /* Don't try to reuse the same piece of text twice. */ |
| 3867 | overlap = same_at_start - BEGV_BYTE - (same_at_end + inserted - ZV_BYTE); | 3888 | overlap = same_at_start - BEGV_BYTE - (same_at_end + inserted - ZV_BYTE); |
| 3868 | if (overlap > 0) | 3889 | if (overlap > 0) |