2015-06-04 18:39 GMT+02:00 Enrico Forestieri <for...@lyx.org>: > Yes, I can reproduce in master. It does not occur in stable, where a > different strategy is used, only involving the instant preview scripts. > If I am not mistaken, it goes like this. When you enter and then leave > a math inset, the generated preview snippet is compared with the cached > ones. If it matches one of them, no further action is taken and the > corresponding image is used. It is the way duplicated macros are avoided > in master that causes this glitch, because the macro definitions are also > cached. When the document is loaded, that snippet contains the macro > definition because it was not appearing before. However, when you > enter and then leave the math inset, the code thinks that the macro > was already defined previously and does not include it anymore. Now the > snippet does not match any of the cached ones because the macro is not > there anymore. Hence, a new preview is attempted but it fails because of > the missing macro definition. > > Fixing this requires a bit more work in master. First of all, the cached > macros should be cleared after a preview cycle completed, such that next > previews involving the same macro can succeed. However, given that the > produced snippet would now be different from when it was generated the > first time (no macro present at that time), the already cached image would > not be used and a new one will be generated. This risks to be highly > inefficient, of course, so something should be thought for avoiding it. >
Yes, I had a closer look at this as well. I am not sure about a good and efficient strategy. Maybe we should store for which insets definitions were cached and remove them from the general cache if this inset is modified. I do not yet have a brilliant idea, though. Jürgen