[LyX features/biginset] Reduce metrics updates from 4 to 1 when loading file

Richard Kimberly Heck rikiheck at gmail.com
Sun Nov 26 21:10:56 UTC 2023


On 11/26/23 16:07, Jean-Marc Lasgouttes wrote:
> Le 24/11/2023 à 21:03, Scott Kostyshak a écrit :
>>> Since such changes can lead to nasty bugs, my plan was to backport 
>>> only part
>>> of the biginset branch (or maybe by bit in different 2.4 releases). 
>>> But if
>>> we feel brave, we can put it all in the 2.4.x branch and see what 
>>> works or
>>> not before release.
>>>
>>> We have time for that any way, but everything that touches events is 
>>> very
>>> brittle.
>>
>> Do I understand correctly that this patch is pretty small? And that it
>> would be easy to revert? If so, it might indeed be nice to put it in
>> 2.4.x so that it gets tested.
>
> Note first that this change is much less jaw-dropping that the change 
> that makes SinglePar update work in insets. I have been disappointed 
> not to notice the difference in practice.
>
> Some patches in the biginset branch make computation more efficient, 
> and I am confident about them (or at least that bugs will be easy to 
> fix).
>
> Patches that avoid full metrics computation are different : these 
> extra metrics computation steps have often been used as an easy (and 
> robust but inefficient) way to fix real issues. Before removing these 
> extra calls, one has to understand what bug they fix, and whether we 
> can be convinced that the new code is immune to the bug.
>
> For the patch above, it might happen that it does not work on Qt6 on 
> macOS (random example), because the events are triggered in a slightly 
> different way.
>
> So each removal of a full metrics computation (Update::Force) is a 
> risk. On my current TODO list I have currently:
>
> * when the cursor enters a math equation, a math toolbar is toggled 
> and create a resize event for the workarea
> => solution is to do a metrics computation only if the width has 
> changed (DONE, seems to work)
>
> * when the cursor enters a math equation, metrics may change if there 
> was a preview, so that an unconditional metrics computation is done
> => solution is to do this only when there was actually a preview, and 
> then only do a SinglePar update (TODO)
>
> * when the cursor leaves the math equation, same as above
>
> * when the cursor leaves the math equation and there is an error with 
> the preview snippet, there is still a full metrics update
> => solution is to avoid the metrics update if the preview has not been 
> loaded (to investigate)
>
> * when clicking in a nested inset, there is a full metrics update (to 
> investigate)
>
>
> As you see there are tons of such situations, and it will not be 
> possible to backport all the fixes for those to 2.4.x

Indeed, and understood. What we can borrow, though, will be welcome. 
Obviously, you know this code better than anyone, so it'll largely be 
your call. Commits early in a cycle will give us the best chance to 
test. I tend to use current stable for my day to day work, and that 
often does involve math insets.

Riki




More information about the lyx-devel mailing list