decrease SAVE_MODIFF and auto_save_modified or increase
MODIFF. */
if (SAVE_MODIFF >= MODIFF)
- SAVE_MODIFF = modiff_incr (&MODIFF);
+ SAVE_MODIFF = modiff_incr (&MODIFF, 1);
if (EQ (flag, Qautosaved))
BUF_AUTOSAVE_MODIFF (b) = MODIFF;
}
bset_point_before_scroll (current_buffer, Qnil);
bset_point_before_scroll (other_buffer, Qnil);
- modiff_incr (¤t_buffer->text->modiff);
- modiff_incr (&other_buffer->text->modiff);
- modiff_incr (¤t_buffer->text->chars_modiff);
- modiff_incr (&other_buffer->text->chars_modiff);
- modiff_incr (¤t_buffer->text->overlay_modiff);
- modiff_incr (&other_buffer->text->overlay_modiff);
+ modiff_incr (¤t_buffer->text->modiff, 1);
+ modiff_incr (&other_buffer->text->modiff, 1);
+ modiff_incr (¤t_buffer->text->chars_modiff, 1);
+ modiff_incr (&other_buffer->text->chars_modiff, 1);
+ modiff_incr (¤t_buffer->text->overlay_modiff, 1);
+ modiff_incr (&other_buffer->text->overlay_modiff, 1);
current_buffer->text->beg_unchanged = current_buffer->text->gpt;
current_buffer->text->end_unchanged = current_buffer->text->gpt;
other_buffer->text->beg_unchanged = other_buffer->text->gpt;
bset_redisplay (buf);
- modiff_incr (&BUF_OVERLAY_MODIFF (buf));
+ modiff_incr (&BUF_OVERLAY_MODIFF (buf), end - start);
}
/* Remove OVERLAY from LIST. */
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);
#endif
record_insert (PT, nchars);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars);
CHARS_MODIFF = MODIFF;
GAP_SIZE -= outgoing_nbytes;
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);
#endif
record_insert (PT, nchars);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars);
CHARS_MODIFF = MODIFF;
GAP_SIZE -= outgoing_nbytes;
if (len == 0)
evaporate_overlays (from);
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del + len);
CHARS_MODIFF = MODIFF;
}
check_markers ();
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del + inschars);
CHARS_MODIFF = MODIFF;
if (adjust_match_data)
check_markers ();
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, nchars_del + inschars);
CHARS_MODIFF = MODIFF;
}
\f
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. */
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);
typedef intmax_t modiff_count;
INLINE modiff_count
-modiff_incr (modiff_count *a)
+modiff_incr (modiff_count *a, ptrdiff_t len)
{
- modiff_count a0 = *a;
- bool modiff_overflow = INT_ADD_WRAPV (a0, 1, a);
+ modiff_count a0 = *a; int incr = len ? 1 : 0;
+ while (len >>= 1) incr++;
+ bool modiff_overflow = INT_ADD_WRAPV (a0, incr, a);
eassert (!modiff_overflow && *a >> 30 >> 30 == 0);
return a0;
}
BUF_COMPUTE_UNCHANGED (buf, b - 1, e);
if (MODIFF <= SAVE_MODIFF)
record_first_change ();
- modiff_incr (&MODIFF);
+ modiff_incr (&MODIFF, 1);
bset_point_before_scroll (current_buffer, Qnil);
/* Check whether the buffer to be displayed contains long lines. */
if (!NILP (Vlong_line_threshold)
&& !current_buffer->long_line_optimizations_p
- && MODIFF != UNCHANGED_MODIFIED)
+ && MODIFF - UNCHANGED_MODIFIED > 4)
{
ptrdiff_t cur, next, found, max = 0;
for (cur = 1; cur < Z; cur = next)