Subject: bug#62333: 30.0.50; Issue with tree-sitter syntax tree during certain changes

From: Eli Zaretskii <[email-masked]>
Date: Fri, 24 Mar 2023 09:05:48 +0300

> From: Yuan Fu <[email-masked]>
> Date: Thu, 23 Mar 2023 16:59:28 -0700
> Cc: Eli Zaretskii <[email-masked]>,
>  Wilhelm Kirschbaum <[email-masked]>,
>  [email-masked]
> 
> > On Mar 23, 2023, at 3:06 PM, Dmitry Gutov <[email-masked]> wrote:
> > 
> > On 23/03/2023 23:18, Yuan Fu wrote:
> >> I guess the question now is why redisplay is triggered in blink-matching-open
> > 
> > blink-matching-open calls sit-for after adjusting overlays.
> > 
> > sit-for starts with a redisplay.
> 
> But it’s not called when narrow-to-region is in effect.

Exactly.  So the question is now: why does treesit.c see ZV changed,
if by the time it is supposed to be called from redisplay the
restriction is restored?

Is the problematic code in treesit.c really called from redisplay
triggered by sit-for in blink-matching-open?  Can you show the C and
Lisp backtrace from the call that "sees that BUF_ZV_BYTE is smaller
than its visible_end"?