Mercurial > emacs
comparison src/coding.c @ 42661:e85e4d9494b1
(code_convert_region): Don't copy old text if undo disabled.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Fri, 11 Jan 2002 21:27:54 +0000 |
| parents | 09cc243e2d14 |
| children | 983767b5ccc0 |
comparison
equal
deleted
inserted
replaced
| 42660:cd6f433b27fa | 42661:e85e4d9494b1 |
|---|---|
| 5303 code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | 5303 code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) |
| 5304 int from, from_byte, to, to_byte, encodep, replace; | 5304 int from, from_byte, to, to_byte, encodep, replace; |
| 5305 struct coding_system *coding; | 5305 struct coding_system *coding; |
| 5306 { | 5306 { |
| 5307 int len = to - from, len_byte = to_byte - from_byte; | 5307 int len = to - from, len_byte = to_byte - from_byte; |
| 5308 int nchars_del = 0, nbytes_del = 0; | |
| 5308 int require, inserted, inserted_byte; | 5309 int require, inserted, inserted_byte; |
| 5309 int head_skip, tail_skip, total_skip = 0; | 5310 int head_skip, tail_skip, total_skip = 0; |
| 5310 Lisp_Object saved_coding_symbol; | 5311 Lisp_Object saved_coding_symbol; |
| 5311 int first = 1; | 5312 int first = 1; |
| 5312 unsigned char *src, *dst; | 5313 unsigned char *src, *dst; |
| 5425 TEMP_SET_PT_BOTH (from, from_byte); | 5426 TEMP_SET_PT_BOTH (from, from_byte); |
| 5426 } | 5427 } |
| 5427 } | 5428 } |
| 5428 | 5429 |
| 5429 if (replace) | 5430 if (replace) |
| 5430 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); | 5431 { |
| 5432 if (! EQ (current_buffer->undo_list, Qt)) | |
| 5433 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); | |
| 5434 else | |
| 5435 { | |
| 5436 nchars_del = to - from; | |
| 5437 nbytes_del = to_byte - from_byte; | |
| 5438 } | |
| 5439 } | |
| 5431 | 5440 |
| 5432 if (coding->composing != COMPOSITION_DISABLED) | 5441 if (coding->composing != COMPOSITION_DISABLED) |
| 5433 { | 5442 { |
| 5434 if (encodep) | 5443 if (encodep) |
| 5435 coding_save_composition (coding, from, to, Fcurrent_buffer ()); | 5444 coding_save_composition (coding, from, to, Fcurrent_buffer ()); |
| 5717 from -= head_skip; from_byte -= head_skip; | 5726 from -= head_skip; from_byte -= head_skip; |
| 5718 to += tail_skip; to_byte += tail_skip; | 5727 to += tail_skip; to_byte += tail_skip; |
| 5719 } | 5728 } |
| 5720 | 5729 |
| 5721 prev_Z = Z; | 5730 prev_Z = Z; |
| 5722 adjust_after_replace (from, from_byte, deletion, inserted, inserted_byte); | 5731 if (! EQ (current_buffer->undo_list, Qt)) |
| 5732 adjust_after_replace (from, from_byte, deletion, inserted, inserted_byte); | |
| 5733 else | |
| 5734 adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, | |
| 5735 inserted, inserted_byte); | |
| 5723 inserted = Z - prev_Z; | 5736 inserted = Z - prev_Z; |
| 5724 | 5737 |
| 5725 if (!encodep && coding->cmp_data && coding->cmp_data->used) | 5738 if (!encodep && coding->cmp_data && coding->cmp_data->used) |
| 5726 coding_restore_composition (coding, Fcurrent_buffer ()); | 5739 coding_restore_composition (coding, Fcurrent_buffer ()); |
| 5727 coding_free_composition_data (coding); | 5740 coding_free_composition_data (coding); |
