aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/insdel.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/insdel.c b/src/insdel.c
index a71afb7258d..486875d2b91 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1391,6 +1391,56 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte)
1391 MODIFF++; 1391 MODIFF++;
1392} 1392}
1393 1393
1394/* Like adjust_after_replace, but doesn't require PREV_TEXT.
1395 This is for use when undo is not enabled in the current buffer. */
1396
1397void
1398adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, len, len_byte)
1399 int from, from_byte, nchars_del, nbytes_del, len, len_byte;
1400{
1401#ifdef BYTE_COMBINING_DEBUG
1402 if (count_combining_before (GPT_ADDR, len_byte, from, from_byte)
1403 || count_combining_after (GPT_ADDR, len_byte, from, from_byte))
1404 abort ();
1405#endif
1406
1407 /* Update various buffer positions for the new text. */
1408 GAP_SIZE -= len_byte;
1409 ZV += len; Z+= len;
1410 ZV_BYTE += len_byte; Z_BYTE += len_byte;
1411 GPT += len; GPT_BYTE += len_byte;
1412 if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
1413
1414 if (nchars_del > 0)
1415 adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
1416 len, len_byte);
1417 else
1418 adjust_markers_for_insert (from, from_byte,
1419 from + len, from_byte + len_byte, 0);
1420
1421 if (len > nchars_del)
1422 adjust_overlays_for_insert (from, len - nchars_del);
1423 else if (len < nchars_del)
1424 adjust_overlays_for_delete (from, nchars_del - len);
1425 if (BUF_INTERVALS (current_buffer) != 0)
1426 {
1427 offset_intervals (current_buffer, from, len - nchars_del);
1428 }
1429
1430 if (from < PT)
1431 adjust_point (len - nchars_del, len_byte - nbytes_del);
1432
1433 /* As byte combining will decrease Z, we must check this again. */
1434 if (Z - GPT < END_UNCHANGED)
1435 END_UNCHANGED = Z - GPT;
1436
1437 CHECK_MARKERS ();
1438
1439 if (len == 0)
1440 evaporate_overlays (from);
1441 MODIFF++;
1442}
1443
1394/* Record undo information, adjust markers and position keepers for an 1444/* Record undo information, adjust markers and position keepers for an
1395 insertion of a text from FROM (FROM_BYTE) to TO (TO_BYTE). The 1445 insertion of a text from FROM (FROM_BYTE) to TO (TO_BYTE). The
1396 text already exists in the current buffer but character length (TO 1446 text already exists in the current buffer but character length (TO