* src/buffer.h (struct buffer_text): New 'unchanged_size' field.
(BUF_UNCHANGED_SIZE): New macro to access the field.
* src/buffer.c (Fget_buffer_create): Initialize the field.
(Fbuffer_swap_text): Handle it.
* src/xdisp.c (mark_window_display_accurate_1): Set the field.
(redisplay_window): Use the field for long lines detection.
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
BUF_END_UNCHANGED (b) = 0;
BUF_BEG_UNCHANGED (b) = 0;
+ BUF_UNCHANGED_SIZE (b) = 0;
*(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */
b->text->inhibit_shrinking = false;
b->text->redisplay = false;
current_buffer->text->end_unchanged = current_buffer->text->gpt;
other_buffer->text->beg_unchanged = other_buffer->text->gpt;
other_buffer->text->end_unchanged = other_buffer->text->gpt;
+ {
+ ptrdiff_t tmp = current_buffer->text->unchanged_size;
+ current_buffer->text->unchanged_size = other_buffer->text->unchanged_size;
+ other_buffer->text->unchanged_size = tmp;
+ }
{
struct Lisp_Marker *m;
for (m = BUF_MARKERS (current_buffer); m; m = m->next)
#define BUF_UNCHANGED_MODIFIED(buf) \
((buf)->text->unchanged_modified)
+#define BUF_UNCHANGED_SIZE(buf) \
+ ((buf)->text->unchanged_size)
+
#define BUF_OVERLAY_UNCHANGED_MODIFIED(buf) \
((buf)->text->overlay_unchanged_modified)
#define BUF_BEG_UNCHANGED(buf) ((buf)->text->beg_unchanged)
end_unchanged contain no useful information. */
modiff_count overlay_unchanged_modified;
+ /* Buffer size as of last redisplay that finished. */
+ ptrdiff_t unchanged_size;
+
/* Properties of this buffer's text. */
INTERVAL intervals;
BUF_OVERLAY_UNCHANGED_MODIFIED (b) = BUF_OVERLAY_MODIFF (b);
BUF_BEG_UNCHANGED (b) = BUF_GPT (b) - BUF_BEG (b);
BUF_END_UNCHANGED (b) = BUF_Z (b) - BUF_GPT (b);
+ BUF_UNCHANGED_SIZE (b) = BUF_Z (b) - BUF_BEG (b);
w->current_matrix->buffer = b;
w->current_matrix->begv = BUF_BEGV (b);
/* Check whether the buffer to be displayed contains long lines. */
if (!NILP (Vlong_line_threshold)
&& !current_buffer->long_line_optimizations_p
- && MODIFF != UNCHANGED_MODIFIED)
+ && Z - BEG - BUF_UNCHANGED_SIZE (current_buffer) <= 1)
{
ptrdiff_t cur, next, found, max = 0;
for (cur = 1; cur < Z; cur = next)