Subject: bug#56682: locked narrowing

From: Eli Zaretskii <[email-masked]>
Date: Wed, 30 Nov 2022 17:03:29 +0200

> Date: Wed, 30 Nov 2022 13:52:48 +0000
> From: Gregory Heytings <[email-masked]>
> cc: [email-masked], [email-masked], [email-masked]
> 
> No, I'm not reverting, I'm fixing.  The condition before 1c837c42c2 was 
> "MODIFF - UNCHANGED_MODIFIED > 8", with 1c837c42c2 it became "CHARS_MODIFF 
> - CHARS_UNCHANGED_MODIFIED > 8", which appeared correct at that time but 
> is not, with the patch it becomes "CHARS_MODIFF - UNCHANGED_MODIFIED > 8".
> 
> >
> > How did you reach the conclusion that the change doesn't do what it was 
> > supposed to? please tell more about what you saw and your conclusions.
> >
> 
> The first condition triggered the long line detection too much: it was 
> triggered when the the only changes in the buffer were fontification 
> changes.  The second condition fixes that problem, but still triggers the 
> long line detection too much: it is still triggered when the main (but not 
> _only_) changes in the buffer are fontification changes, IOW, it is 
> triggered even if a single character is inserted and "enough" 
> fontification changes are made.  The condition in the patch is correct: 
> the long line detection mechanism is triggered only when many characters 
> are inserted.

Ah, okay.  But let's take this opportunity to limit the search region as
well, OK?  I think it will be a better, more thorough fix, especially for
very large buffers without long lines.