Subject: Re: bug#56682: locked narrowing

From: Eli Zaretskii <[email-masked]>
Date: Fri, 02 Dec 2022 10:04:37 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Thu, 01 Dec 2022 21:52:03 -0500
> 
> My suggestion was to have as "steady state" that "everything is scanned
> except for a region between BEG...END and no line was found to be larger
> than MAX_SEEN_LINE_LENGTH".  So it requires keeping track of a BEG..END
> (BEG can be an integer but END would likely be an (insert-before)
> marker) plus an integer keeping track of MAX_SEEN_LINE_LENGTH.
> Initially BEG is 1 and END is Z.

I don't understand how you keep track of BEG and END, in general.  E.g.,
deletion of a single character can in some cases reset BEG to 1 and END to
Z, right?

> I can't think of a good way to detect when MAX_SEEN_LINE_LENGTH can be
> made smaller, tho, so we might still need to rescan the whole buffer
> every once in a blue moon.

That, too, is a complication.  Once again, there's absolutely no reason to
scan more than a limited region around point where redisplay is likely to
look.  Scanning the entire buffer is a waste, and can potentially degrade
performance in very large buffers without any long lines.