aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-03-12 00:42:35 +0000
committerKenichi Handa1998-03-12 00:42:35 +0000
commit61415a2589e8e71e1c820198bbc18385f7d3d7cb (patch)
treeac5c84f61982345192d91d7657a2aecd8c56dcad /src
parentf8198e198dc5274b5ee46bddda5d31e52f2979b2 (diff)
downloademacs-61415a2589e8e71e1c820198bbc18385f7d3d7cb.tar.gz
emacs-61415a2589e8e71e1c820198bbc18385f7d3d7cb.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/insdel.c66
1 files changed, 49 insertions, 17 deletions
diff --git a/src/insdel.c b/src/insdel.c
index 6eff006cb6c..1a677d070f0 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1300,33 +1300,65 @@ adjust_before_replace (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 the beginning or end of the replacement text to form one character. */
1310 1309
1311void 1310void
1312adjust_after_replace (from, from_byte, to, to_byte, len, len_byte, 1311adjust_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;
1316{ 1313{
1317 int adjusted_nchars = len - combined_before_bytes - combined_after_bytes; 1314 int combined_before_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,
1321 len_byte - (to_byte - from_byte) + combined_after_bytes);
1322#ifdef USE_TEXT_PROPERTIES
1323 offset_intervals (current_buffer, PT, adjusted_nchars - (to - from));
1324#endif
1325 adjust_overlays_for_delete (from, to - from);
1326 adjust_overlays_for_insert (from, adjusted_nchars);
1327 adjust_markers_for_insert (from, from_byte, 1338 adjust_markers_for_insert (from, from_byte,
1328 from + adjusted_nchars, from_byte + len_byte, 1339 from + len, from_byte + len_byte,
1329 combined_before_bytes, combined_after_bytes, 0); 1340 combined_before_bytes, combined_after_bytes, 0);
1341#ifdef USE_TEXT_PROPERTIES
1342 if (BUF_INTERVALS (current_buffer) != 0)
1343 offset_intervals (current_buffer, from, len - (to - from));
1344#endif
1345
1346 {
1347 int pos = PT, pos_byte = PT_BYTE;
1348
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++;