Subject: bug#56393: Turn on narrowing in redisplay_window

From: Gerd Möllmann <[email-masked]>
Date: Tue, 19 Jul 2022 11:25:53 +0200

Gregory Heytings <[email-masked]> writes:

>> - I don't understand this in redisplay_window:
>>
>>  /* Check whether the buffer to be displayed contains long lines.  */
>>  if (!NILP (Vlong_line_threshold)
>>      && !current_buffer->long_line_optimizations_p
>>      && Z - BEG - BUF_UNCHANGED_SIZE (current_buffer) <= 1)
>>
>> Does the last line mean "buffer got smaller"?  Sorry if I'm dense
>> here, but I don't get it.
>>
>
> It is (- (point-max) (point-min) (buffer-size-after-last-redisplay)),

Sorry, maybe it's too hot here to think (36°C currently), I still don't
get it

     (- (point-max) (point-min))  = current buffer size

so

     current-buffer-size - last-buffer-size <= 1
     current-buffer-size <= 1 + last-buffer-size

which is "the buffer got smaller"?

> so it means "the buffer got larger by more than one character".  (Note
> that (buffer-size-after-last-redisplay) is a fictional function.)

Goes without saying.

> But after discussing this with Eli I'm not convinced that it's a good
> enough heuristic.  The previous heuristic was simply "the buffer
> contents have changed", and I wanted to refine it a bit.

Okay.  Hm.