Subject: bug#56682: locked narrowing

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 Aug 2022 21:33:40 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Wed, 17 Aug 2022 13:58:21 -0400
> 
> [ BTW, apparently when `display_line_numbers_widen` is in use and the
>   buffer is narrowed, we don't use that cache at all for
>   `maybe_produce_line_number` (according to xdisp.c:24217).  IOW that
>   cache always counts from BEGV, so we also need to check that BEGV is
>   still the same as when the cache was filled.  I also can't see in
>   `decode_mode_spec` where we check that the narrowing has changed
>   before using the cached value.  All in all, I just don't understand
>   how that cache is maintained.  ]

Search in xdisp.c for "->base_line_number = 0", and you will see that
we invalidate the cache when the narrowing changes or when other
similar calamities happen.