diff options
| author | Kenichi Handa | 2013-03-10 23:36:35 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2013-03-10 23:36:35 +0900 |
| commit | c230dd7d89730f565df77046d0666d2082e386ee (patch) | |
| tree | 9f63b2d8ba43f9ab3d244e252aaf9f26fea12daa /src/insdel.c | |
| parent | 27a98a62d1c46b057428cc3ed964743b69628299 (diff) | |
| download | emacs-c230dd7d89730f565df77046d0666d2082e386ee.tar.gz emacs-c230dd7d89730f565df77046d0666d2082e386ee.zip | |
On file insertion, skip decoding if all bytes are ASCII.
Diffstat (limited to 'src/insdel.c')
| -rw-r--r-- | src/insdel.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/insdel.c b/src/insdel.c index fc5a4576dc2..992cebb04b0 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1162,14 +1162,16 @@ insert_from_buffer_1 (struct buffer *buf, | |||
| 1162 | 1162 | ||
| 1163 | /* Record undo information and adjust markers and position keepers for | 1163 | /* Record undo information and adjust markers and position keepers for |
| 1164 | a replacement of a text PREV_TEXT at FROM to a new text of LEN | 1164 | a replacement of a text PREV_TEXT at FROM to a new text of LEN |
| 1165 | chars (LEN_BYTE bytes) which resides in the gap just after | 1165 | chars (LEN_BYTE bytes). If TEXT_AT_GAP_TAIL is zero, the new text |
| 1166 | GPT_ADDR. | 1166 | resides in the gap just after GPT_BYTE. Otherwise, the text |
| 1167 | resides at the gap tail; i.e. at (GAP_END_ADDR - LEN_BNYTE). | ||
| 1167 | 1168 | ||
| 1168 | PREV_TEXT nil means the new text was just inserted. */ | 1169 | PREV_TEXT nil means the new text was just inserted. */ |
| 1169 | 1170 | ||
| 1170 | static void | 1171 | void |
| 1171 | adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, | 1172 | adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, |
| 1172 | Lisp_Object prev_text, ptrdiff_t len, ptrdiff_t len_byte) | 1173 | Lisp_Object prev_text, ptrdiff_t len, ptrdiff_t len_byte, |
| 1174 | int text_at_gap_tail) | ||
| 1173 | { | 1175 | { |
| 1174 | ptrdiff_t nchars_del = 0, nbytes_del = 0; | 1176 | ptrdiff_t nchars_del = 0, nbytes_del = 0; |
| 1175 | 1177 | ||
| @@ -1189,8 +1191,11 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, | |||
| 1189 | GAP_SIZE -= len_byte; | 1191 | GAP_SIZE -= len_byte; |
| 1190 | ZV += len; Z+= len; | 1192 | ZV += len; Z+= len; |
| 1191 | ZV_BYTE += len_byte; Z_BYTE += len_byte; | 1193 | ZV_BYTE += len_byte; Z_BYTE += len_byte; |
| 1192 | GPT += len; GPT_BYTE += len_byte; | 1194 | if (! text_at_gap_tail) |
| 1193 | if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ | 1195 | { |
| 1196 | GPT += len; GPT_BYTE += len_byte; | ||
| 1197 | if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ | ||
| 1198 | } | ||
| 1194 | 1199 | ||
| 1195 | if (nchars_del > 0) | 1200 | if (nchars_del > 0) |
| 1196 | adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, | 1201 | adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, |
| @@ -1245,7 +1250,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte, | |||
| 1245 | GPT -= len; GPT_BYTE -= len_byte; | 1250 | GPT -= len; GPT_BYTE -= len_byte; |
| 1246 | ZV -= len; ZV_BYTE -= len_byte; | 1251 | ZV -= len; ZV_BYTE -= len_byte; |
| 1247 | Z -= len; Z_BYTE -= len_byte; | 1252 | Z -= len; Z_BYTE -= len_byte; |
| 1248 | adjust_after_replace (from, from_byte, Qnil, newlen, len_byte); | 1253 | adjust_after_replace (from, from_byte, Qnil, newlen, len_byte, 0); |
| 1249 | } | 1254 | } |
| 1250 | 1255 | ||
| 1251 | /* Replace the text from character positions FROM to TO with NEW, | 1256 | /* Replace the text from character positions FROM to TO with NEW, |