On 04/12/2011 04:20 PM, Tommaso Cucinotta wrote:
Il 12/04/2011 15:14, Richard Heck ha scritto:
On 04/12/2011 04:59 AM, Tommaso Cucinotta wrote:
Il 12/04/2011 02:23, Richard Heck ha scritto:
On 04/11/2011 06:15 PM, Tommaso Cucinotta wrote:
I guess that, at the end of findAndReplace() in lyxfind.cpp at line 1345, I'm missing something to update the previewed insets that have been affected by the replace operation. For now I have a

    bv->processUpdateFlags(Update::Force);

which is obviously insufficient.

Try bv->forceBufferUpdate(). Might work.

unfortunately it doesn't (see patch below). What else can I try ?

Actually, sorry, I have seen this same bug, too, now that I think about it.

I think you need to arrange somehow to call reloadPreview() on the math (and preview?) insets that have been changed. Right now that only gets called when the cursor exits the inset. Maybe you should collect them and then do it at the end?

I did it in r38355 (maybe there's a way to understand exactly which math insets need to be updated, instead of doing that buffer-wise), however this scares me a bit: should we call this reloadPreview() method each and every time something is changed ?

Normally, changes that affect the previews will trigger the notifyCursorLeaves() method which will trigger the reload. But this version shouldn't be too expensive, since the replace operation takes time, anyway. Each inset will more or less check itself to see whether it needs to be reloaded; only the ones that changed actually will be: If the LaTeX snippet hasn't changed, nothing will be done.

Richard

Reply via email to