chokes when a buffer on display contains long lines. If you still
experience slowdowns while editing files with long lines, this is
either due to font locking, which you can turn off with M-x
-font-lock-mode, or to the current major mode or one of the enabled
-minor modes, in which case you should open the the file with M-x
-find-file-literally instead of C-x C-f. The variable
+font-lock-mode or C-u C-x x f, or to the current major mode or one of
+the enabled minor modes, in which case you should open the the file
+with M-x find-file-literally instead of C-x C-f. The variable
'long-line-threshold' controls whether and when these display
optimizations are used.
bset_redisplay (buf);
- modiff_incr (&BUF_OVERLAY_MODIFF (buf), end - start);
+ modiff_incr (&BUF_OVERLAY_MODIFF (buf), 1);
}
/* Remove OVERLAY from LIST. */
ptrdiff_t z_byte; /* Byte pos of end of buffer. */
ptrdiff_t gap_size; /* Size of buffer's gap. */
modiff_count modiff; /* This counts buffer-modification events
- for this buffer. It is incremented for
- each such event, and never otherwise
- changed. */
+ for this buffer. It is increased
+ logarithmically to the extent of the
+ modification for each such event,
+ and never otherwise changed. */
modiff_count chars_modiff; /* This is modified with character change
events for this buffer. It is set to
modiff for each such event, and never
modiff_incr (modiff_count *a, ptrdiff_t len)
{
modiff_count a0 = *a; int incr = len ? 1 : 0;
+ /* Increase the counter more for a large modification and less for a
+ small modification. Increase it logarithmically to avoid
+ increasing it too much. */
while (len >>= 1) incr++;
bool modiff_overflow = INT_ADD_WRAPV (a0, incr, a);
eassert (!modiff_overflow && *a >> 30 >> 30 == 0);
/* Check whether the buffer to be displayed contains long lines. */
if (!NILP (Vlong_line_threshold)
&& !current_buffer->long_line_optimizations_p
- && MODIFF - UNCHANGED_MODIFIED > 4)
+ && MODIFF - UNCHANGED_MODIFIED > 8)
{
ptrdiff_t cur, next, found, max = 0;
for (cur = 1; cur < Z; cur = next)