summaryrefslogtreecommitdiff
path: root/src/insdel.c
diff options
context:
space:
mode:
authorGregory Heytings <gregory@heytings.org>2022-07-19 21:21:40 +0000
committerGregory Heytings <gregory@heytings.org>2022-07-19 23:34:09 +0200
commit7c0fc853649c7e203814295de32357cfd6a336a9 (patch)
tree9234ae81bb18ce6403c4859b37b8e39583ccc3bf /src/insdel.c
parentc6bee1707523549ce02eadb506f54e9089ea1a3f (diff)
downloademacs-7c0fc853649c7e203814295de32357cfd6a336a9.tar.gz
Simplified and improved heuristic for long lines detection.
* src/lisp.h (modiff_incr): Add a parameter to 'modiff_incr' to record the extent of the modification. * src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap, insert_from_buffer_1, adjust_after_replace, replace_range, replace_range_2, del_range_2, modify_text): Add an argument to each call to 'modiff_incr'. * src/textprop.c (modify_text_properties): Add an argument to the call to 'modiff_incr'. * src/buffer.c (Frestore_buffer_modified_p, Fbuffer_swap_text, modify_overlay): Add an argument to each call to 'modiff_incr'. * src/xdisp.c (redisplay_window): Use the improved version of 'MODIFF' for the heuristic.
Diffstat (limited to 'src/insdel.c')
-rw-r--r--src/insdel.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/insdel.c b/src/insdel.c
index 6f180ac5800..309ca728a4c 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -909,7 +909,7 @@ insert_1_both (const char *string,
the insertion. This, together with recording the insertion,
will add up to the right stuff in the undo list. */
record_insert (PT, nchars);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars);
CHARS_MODIFF = MODIFF;
memcpy (GPT_ADDR, string, nbytes);
@@ -1037,7 +1037,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
#endif
record_insert (PT, nchars);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars);
CHARS_MODIFF = MODIFF;
GAP_SIZE -= outgoing_nbytes;
@@ -1122,7 +1122,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail)
of this dance. */
invalidate_buffer_caches (current_buffer, GPT, GPT);
record_insert (GPT, nchars);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars);
insert_from_gap_1 (nchars, nbytes, text_at_gap_tail);
@@ -1250,7 +1250,7 @@ insert_from_buffer_1 (struct buffer *buf,
#endif
record_insert (PT, nchars);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars);
CHARS_MODIFF = MODIFF;
GAP_SIZE -= outgoing_nbytes;
@@ -1351,7 +1351,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
if (len == 0)
evaporate_overlays (from);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del + len);
CHARS_MODIFF = MODIFF;
}
@@ -1546,7 +1546,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
check_markers ();
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del + inschars);
CHARS_MODIFF = MODIFF;
if (adjust_match_data)
@@ -1680,7 +1680,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
check_markers ();
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del + inschars);
CHARS_MODIFF = MODIFF;
}
@@ -1855,7 +1855,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
at the end of the text before the gap. */
adjust_markers_for_delete (from, from_byte, to, to_byte);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del);
CHARS_MODIFF = MODIFF;
/* Relocate point as if it were a marker. */
@@ -1909,7 +1909,7 @@ modify_text (ptrdiff_t start, ptrdiff_t end)
BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end);
if (MODIFF <= SAVE_MODIFF)
record_first_change ();
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, end - start);
CHARS_MODIFF = MODIFF;
bset_point_before_scroll (current_buffer, Qnil);