Improve detection of long lines.
* src/buffer.h (struct buffer_text): New field. (BUF_CHARS_UNCHANGED_MODIFIED, CHARS_UNCHANGED_MODIFIED): New macros. * src/buffer.c (Fget_buffer_create): Initialize the new field. * src/xdisp.c (mark_window_display_accurate_1): Set the new field. (redisplay_window): Use it, together with CHARS_MODIFF, instead of MODIFF and UNCHANGED_MODIFIED to decide whether to check for long lines. * src/pdumper.c (dump_buffer): Dump the new field.
This commit is contained in:
parent
5d3a99602f
commit
1c837c42c2
4 changed files with 13 additions and 1 deletions
|
@ -597,6 +597,7 @@ even if it is dead. The return value is never nil. */)
|
|||
set_buffer_intervals (b, NULL);
|
||||
BUF_UNCHANGED_MODIFIED (b) = 1;
|
||||
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
|
||||
BUF_CHARS_UNCHANGED_MODIFIED (b) = 1;
|
||||
BUF_END_UNCHANGED (b) = 0;
|
||||
BUF_BEG_UNCHANGED (b) = 0;
|
||||
*(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */
|
||||
|
|
|
@ -149,12 +149,18 @@ enum { BEG = 1, BEG_BYTE = BEG };
|
|||
#define BUF_BEG_UNCHANGED(buf) ((buf)->text->beg_unchanged)
|
||||
#define BUF_END_UNCHANGED(buf) ((buf)->text->end_unchanged)
|
||||
|
||||
#define BUF_CHARS_UNCHANGED_MODIFIED(buf) \
|
||||
((buf)->text->chars_unchanged_modified)
|
||||
|
||||
#define UNCHANGED_MODIFIED \
|
||||
BUF_UNCHANGED_MODIFIED (current_buffer)
|
||||
#define OVERLAY_UNCHANGED_MODIFIED \
|
||||
BUF_OVERLAY_UNCHANGED_MODIFIED (current_buffer)
|
||||
#define BEG_UNCHANGED BUF_BEG_UNCHANGED (current_buffer)
|
||||
#define END_UNCHANGED BUF_END_UNCHANGED (current_buffer)
|
||||
|
||||
#define CHARS_UNCHANGED_MODIFIED \
|
||||
BUF_CHARS_UNCHANGED_MODIFIED (current_buffer)
|
||||
|
||||
/* Functions to set PT in the current buffer, or another buffer. */
|
||||
|
||||
|
@ -268,6 +274,9 @@ struct buffer_text
|
|||
end_unchanged contain no useful information. */
|
||||
modiff_count overlay_unchanged_modified;
|
||||
|
||||
/* CHARS_MODIFF as of last redisplay that finished. */
|
||||
modiff_count chars_unchanged_modified;
|
||||
|
||||
/* Properties of this buffer's text. */
|
||||
INTERVAL intervals;
|
||||
|
||||
|
|
|
@ -2764,6 +2764,7 @@ dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
|
|||
DUMP_FIELD_COPY (out, buffer, own_text.end_unchanged);
|
||||
DUMP_FIELD_COPY (out, buffer, own_text.unchanged_modified);
|
||||
DUMP_FIELD_COPY (out, buffer, own_text.overlay_unchanged_modified);
|
||||
DUMP_FIELD_COPY (out, buffer, own_text.chars_unchanged_modified);
|
||||
if (buffer->own_text.intervals)
|
||||
dump_field_fixup_later (ctx, out, buffer, &buffer->own_text.intervals);
|
||||
dump_field_lv_rawptr (ctx, out, buffer, &buffer->own_text.markers,
|
||||
|
|
|
@ -17323,6 +17323,7 @@ mark_window_display_accurate_1 (struct window *w, bool accurate_p)
|
|||
|
||||
BUF_UNCHANGED_MODIFIED (b) = BUF_MODIFF (b);
|
||||
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = BUF_OVERLAY_MODIFF (b);
|
||||
BUF_CHARS_UNCHANGED_MODIFIED (b) = BUF_CHARS_MODIFF (b);
|
||||
BUF_BEG_UNCHANGED (b) = BUF_GPT (b) - BUF_BEG (b);
|
||||
BUF_END_UNCHANGED (b) = BUF_Z (b) - BUF_GPT (b);
|
||||
|
||||
|
@ -19585,7 +19586,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 > 8)
|
||||
&& CHARS_MODIFF - CHARS_UNCHANGED_MODIFIED > 8)
|
||||
{
|
||||
ptrdiff_t cur, next, found, max = 0, threshold;
|
||||
threshold = XFIXNUM (Vlong_line_threshold);
|
||||
|
|
Loading…
Add table
Reference in a new issue