Further tweaks to long lines handling.
* src/xdisp.c (redisplay_window): Increase the threshold above which long lines detection is performed in the buffer. This should avoid triggering that detection for most simple editing operations. * src/lisp.h (modiff_incr): Explain why the counter is incremented logarithmically. * src/buffer.h (struct buffer_text): Adapt the comment about the 'modiff' field accordingly. * src/buffer.c (modify_overlay): Increase the counter by 1 instead of the size of the buffer section on which the overlay is placed. * etc/NEWS: Small improvement.
This commit is contained in:
parent
7c0fc85364
commit
c7eef61eee
5 changed files with 12 additions and 8 deletions
6
etc/NEWS
6
etc/NEWS
|
@ -330,9 +330,9 @@ The display of long lines has been optimized, and Emacs no longer
|
|||
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.
|
||||
|
||||
|
|
|
@ -4010,7 +4010,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
|
|||
|
||||
bset_redisplay (buf);
|
||||
|
||||
modiff_incr (&BUF_OVERLAY_MODIFF (buf), end - start);
|
||||
modiff_incr (&BUF_OVERLAY_MODIFF (buf), 1);
|
||||
}
|
||||
|
||||
/* Remove OVERLAY from LIST. */
|
||||
|
|
|
@ -237,9 +237,10 @@ struct buffer_text
|
|||
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
|
||||
|
|
|
@ -3914,6 +3914,9 @@ INLINE modiff_count
|
|||
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);
|
||||
|
|
|
@ -19293,7 +19293,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
|
|||
/* 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)
|
||||
|
|
Loading…
Add table
Reference in a new issue