Mercurial > emacs
comparison src/coding.c @ 57285:9093a2e9c3fd
(code_convert_region): Don't skip ASCIIs if there are compositions to encode.
Free composition data.
(encode_coding_string): Likewise.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Wed, 29 Sep 2004 23:40:30 +0000 |
| parents | 40a0843be50a |
| children | ffc46016071f f70dc61a797f |
comparison
equal
deleted
inserted
replaced
| 57284:5293cc67f41d | 57285:9093a2e9c3fd |
|---|---|
| 5648 coding_save_composition (coding, from, to, Fcurrent_buffer ()); | 5648 coding_save_composition (coding, from, to, Fcurrent_buffer ()); |
| 5649 else | 5649 else |
| 5650 coding_allocate_composition_data (coding, from); | 5650 coding_allocate_composition_data (coding, from); |
| 5651 } | 5651 } |
| 5652 | 5652 |
| 5653 /* Try to skip the heading and tailing ASCIIs. */ | 5653 /* Try to skip the heading and tailing ASCIIs. We can't skip them |
| 5654 if (coding->type != coding_type_ccl) | 5654 if we must run CCL program or there are compositions to |
| 5655 encode. */ | |
| 5656 if (coding->type != coding_type_ccl | |
| 5657 && (! coding->cmp_data || coding->cmp_data->used == 0)) | |
| 5655 { | 5658 { |
| 5656 int from_byte_orig = from_byte, to_byte_orig = to_byte; | 5659 int from_byte_orig = from_byte, to_byte_orig = to_byte; |
| 5657 | 5660 |
| 5658 if (from < GPT && GPT < to) | 5661 if (from < GPT && GPT < to) |
| 5659 move_gap_both (from, from_byte); | 5662 move_gap_both (from, from_byte); |
| 5665 coding->produced = len_byte; | 5668 coding->produced = len_byte; |
| 5666 coding->produced_char = len; | 5669 coding->produced_char = len; |
| 5667 if (!replace) | 5670 if (!replace) |
| 5668 /* We must record and adjust for this new text now. */ | 5671 /* We must record and adjust for this new text now. */ |
| 5669 adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len); | 5672 adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len); |
| 5673 coding_free_composition_data (coding); | |
| 5670 return 0; | 5674 return 0; |
| 5671 } | 5675 } |
| 5672 | 5676 |
| 5673 head_skip = from_byte - from_byte_orig; | 5677 head_skip = from_byte - from_byte_orig; |
| 5674 tail_skip = to_byte_orig - to_byte; | 5678 tail_skip = to_byte_orig - to_byte; |
| 6295 } | 6299 } |
| 6296 | 6300 |
| 6297 if (coding->composing != COMPOSITION_DISABLED) | 6301 if (coding->composing != COMPOSITION_DISABLED) |
| 6298 coding_save_composition (coding, from, to, str); | 6302 coding_save_composition (coding, from, to, str); |
| 6299 | 6303 |
| 6300 /* Try to skip the heading and tailing ASCIIs. */ | 6304 /* Try to skip the heading and tailing ASCIIs. We can't skip them |
| 6301 if (coding->type != coding_type_ccl) | 6305 if we must run CCL program or there are compositions to |
| 6306 encode. */ | |
| 6307 if (coding->type != coding_type_ccl | |
| 6308 && (! coding->cmp_data || coding->cmp_data->used == 0)) | |
| 6302 { | 6309 { |
| 6303 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), | 6310 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), |
| 6304 1); | 6311 1); |
| 6305 if (from == to_byte) | 6312 if (from == to_byte) |
| 6306 return (nocopy ? str : Fcopy_sequence (str)); | 6313 { |
| 6314 coding_free_composition_data (coding); | |
| 6315 return (nocopy ? str : Fcopy_sequence (str)); | |
| 6316 } | |
| 6307 shrinked_bytes = from + (SBYTES (str) - to_byte); | 6317 shrinked_bytes = from + (SBYTES (str) - to_byte); |
| 6308 } | 6318 } |
| 6309 | 6319 |
| 6310 len = encoding_buffer_size (coding, to_byte - from); | 6320 len = encoding_buffer_size (coding, to_byte - from); |
| 6311 allocate_conversion_buffer (buf, len); | 6321 allocate_conversion_buffer (buf, len); |
