bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56682: Fix the long lines font locking related slowdowns


From: Eli Zaretskii
Subject: bug#56682: Fix the long lines font locking related slowdowns
Date: Sun, 31 Jul 2022 10:11:42 +0300

> Cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org,
>  monnier@iro.umontreal.ca
> Date: Sat, 30 Jul 2022 18:23:12 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Date: Sat, 30 Jul 2022 13:31:42 +0000
> > From: Gregory Heytings <gregory@heytings.org>
> > cc: gerd.moellmann@gmail.com, 56682@debbugs.gnu.org, larsi@gnus.org, 
> >     monnier@iro.umontreal.ca
> > 
> > So the only remaining question is whether it is necessary to recompute 
> > narrowed_begv and narrowed_zv in init_iterator:
> 
> I tend to think we should, but let me think about this some more.

Here are my thoughts.

First, I think the setting of narrowed_begv and narrowed_zv should be
done in 'reseat', not in init_iterator.  The latter always calls the
former when invoked to start iteration of buffer text, but we also
call 'reseat' from other places, when we "jump" the iterator to a new
place, potentially far from the last.  If nothing else, this should
help with truncate-lines, where using window_point is basically right
only for the point's line.  And currently, init_iterator computes and
sets the narrowing even when we iterate on strings, which is unneeded
and incorrect.

Whether always to correct narrowed_begv and narrowed_zv if we are
reseating to a position outside the narrowing, is a more complicated
question.  The basic problem here is that we don't have an easy way of
restoring the previous narrowing (except by unwind_protect), and the
display code sometimes calls init_iterator or start_display using the
iterator that already has these members set by previous code, a
situation which we currently cannot easily detect.  However, when this
code runs as part of redisplay, we generally don't expect the original
narrowing to be insufficient, except perhaps in the truncate-line
case.

So I think we should correct narrowed_begv and narrowed_zv only if
either the 'redisplaying_p' flag is reset (meaning the display code is
being invoked outside of redisplay) or it->line_wrap == TRUNCATE.

Comments? thoughts?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]