summaryrefslogtreecommitdiff
path: root/src/insdel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/insdel.c')
-rw-r--r--src/insdel.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/insdel.c b/src/insdel.c
index 4ad1074f5f7..fc3f19fd581 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1268,7 +1268,9 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
/* Replace the text from character positions FROM to TO with NEW,
If PREPARE, call prepare_to_modify_buffer.
If INHERIT, the newly inserted text should inherit text properties
- from the surrounding non-deleted text. */
+ from the surrounding non-deleted text.
+ If ADJUST_MATCH_DATA, then adjust the match data before calling
+ signal_after_change. */
/* Note that this does not yet handle markers quite right.
Also it needs to record a single undo-entry that does a replacement
@@ -1279,7 +1281,8 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
void
replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
- bool prepare, bool inherit, bool markers)
+ bool prepare, bool inherit, bool markers,
+ bool adjust_match_data)
{
ptrdiff_t inschars = SCHARS (new);
ptrdiff_t insbytes = SBYTES (new);
@@ -1426,6 +1429,9 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
MODIFF++;
CHARS_MODIFF = MODIFF;
+ if (adjust_match_data)
+ update_search_regs (from, to, from + SCHARS (new));
+
signal_after_change (from, nchars_del, GPT - from);
update_compositions (from, GPT, CHECK_BORDER);
}