Mercurial > emacs
comparison src/insdel.c @ 21139:48b83e612b06
(adjust_before_replace): Call
adjust_overlays_for_delete.
(adjust_after_replace): Delete args COMBINED_BEFORE_BYTES and
COMBINED_AFTER_BYTES. This makes the newly generated text
following GPT_ADDR a buffer contents.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 12 Mar 1998 00:42:35 +0000 |
parents | f4df45f5a0e2 |
children | 15d4310cb9e7 |
comparison
equal
deleted
inserted
replaced
21138:d10664297ed2 | 21139:48b83e612b06 |
---|---|
1298 adjust_before_replace (from, from_byte, to, to_byte) | 1298 adjust_before_replace (from, from_byte, to, to_byte) |
1299 int from, from_byte, to, to_byte; | 1299 int from, from_byte, to, to_byte; |
1300 { | 1300 { |
1301 adjust_markers_for_delete (from, from_byte, to, to_byte); | 1301 adjust_markers_for_delete (from, from_byte, to, to_byte); |
1302 record_delete (from, to - from); | 1302 record_delete (from, to - from); |
1303 adjust_overlays_for_delete (from, to - from); | |
1303 } | 1304 } |
1304 | 1305 |
1305 /* This function should be called after altering the text between FROM | 1306 /* This function should be called after altering the text between FROM |
1306 and TO to a new text of LEN chars (LEN_BYTE bytes). | 1307 and TO to a new text of LEN chars (LEN_BYTE bytes), but before |
1307 COMBINED_BEFORE_BYTES and COMBINED_AFTER_BYTES are the number | 1308 making the text a buffer contents. It exists just after GPT_ADDR. */ |
1308 of bytes before (resp. after) the change which combine with | 1309 |
1309 the beginning or end of the replacement text to form one character. */ | 1310 void |
1310 | 1311 adjust_after_replace (from, from_byte, to, to_byte, len, len_byte) |
1311 void | |
1312 adjust_after_replace (from, from_byte, to, to_byte, len, len_byte, | |
1313 combined_before_bytes, combined_after_bytes) | |
1314 int from, from_byte, to, to_byte, len, len_byte; | 1312 int from, from_byte, to, to_byte, len, len_byte; |
1315 int combined_before_bytes, combined_after_bytes; | 1313 { |
1316 { | 1314 int combined_before_bytes |
1317 int adjusted_nchars = len - combined_before_bytes - combined_after_bytes; | 1315 = count_combining_before (GPT_ADDR, len_byte, from, from_byte); |
1316 int combined_after_bytes | |
1317 = count_combining_after (GPT_ADDR, len_byte, from, from_byte); | |
1318 | |
1319 if (combined_after_bytes) | |
1320 record_delete (from, combined_after_bytes); | |
1321 | |
1322 if (combined_before_bytes) | |
1323 record_delete (from - 1, 1); | |
1324 | |
1325 /* Update various buffer positions for the new text. */ | |
1326 GAP_SIZE -= len_byte; | |
1327 ZV += len; Z+= len; | |
1328 ZV_BYTE += len_byte; Z_BYTE += len_byte; | |
1329 GPT += len; GPT_BYTE += len_byte; | |
1330 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ | |
1331 | |
1332 if (combined_after_bytes) | |
1333 move_gap_both (GPT + combined_after_bytes, | |
1334 GPT_BYTE + combined_after_bytes); | |
1335 | |
1318 record_insert (from - !!combined_before_bytes, len); | 1336 record_insert (from - !!combined_before_bytes, len); |
1319 if (from < PT) | 1337 adjust_overlays_for_insert (from, len); |
1320 adjust_point (len - (to - from) + combined_after_bytes, | 1338 adjust_markers_for_insert (from, from_byte, |
1321 len_byte - (to_byte - from_byte) + combined_after_bytes); | 1339 from + len, from_byte + len_byte, |
1340 combined_before_bytes, combined_after_bytes, 0); | |
1322 #ifdef USE_TEXT_PROPERTIES | 1341 #ifdef USE_TEXT_PROPERTIES |
1323 offset_intervals (current_buffer, PT, adjusted_nchars - (to - from)); | 1342 if (BUF_INTERVALS (current_buffer) != 0) |
1343 offset_intervals (current_buffer, from, len - (to - from)); | |
1324 #endif | 1344 #endif |
1325 adjust_overlays_for_delete (from, to - from); | 1345 |
1326 adjust_overlays_for_insert (from, adjusted_nchars); | 1346 { |
1327 adjust_markers_for_insert (from, from_byte, | 1347 int pos = PT, pos_byte = PT_BYTE; |
1328 from + adjusted_nchars, from_byte + len_byte, | 1348 |
1329 combined_before_bytes, combined_after_bytes, 0); | 1349 if (from < PT) |
1350 adjust_point (len - (to - from) + combined_after_bytes, | |
1351 len_byte - (to_byte - from_byte) + combined_after_bytes); | |
1352 else if (from == PT && combined_before_bytes) | |
1353 adjust_point (0, combined_before_bytes); | |
1354 | |
1355 if (combined_after_bytes) | |
1356 combine_bytes (from + len, from_byte + len_byte, combined_after_bytes); | |
1357 | |
1358 if (combined_before_bytes) | |
1359 combine_bytes (from, from_byte, combined_before_bytes); | |
1360 } | |
1361 | |
1330 if (len == 0) | 1362 if (len == 0) |
1331 evaporate_overlays (from); | 1363 evaporate_overlays (from); |
1332 MODIFF++; | 1364 MODIFF++; |
1333 } | 1365 } |
1334 | 1366 |