Georg Baum wrote:
This bug is driving me mad currently. Abdel gave some explanation:
http://bugzilla.lyx.org/show_bug.cgi?id=3118#c3
Unfortunately I don't understand it. AFAIK the coord cache is set by calling
setPosCache(pi, x, y);
in an inset. I did not check all insets, but in those I checked (including
InsetText and InsetTabular) this is done in the draw() method. Abdel, can
you please explain how the coord cache is set in the metrics method?
My next question is about InsetMathNest::cursorPos(). This code
if (!coord_cache.getArrays().has(&ar)) {
// this can (semi-)legally happen if we just created this cell
// and it never has been drawn before. So don't ASSERT.
//lyxerr << "no cached data for array " << &ar << endl;
x = 0;
y = 0;
return;
}
looks really like a bad hack. If we make sure that the coord cache is always
set in the metrics method as Abdel suggests, then I don't see how we could
get here with an invalid coord cache, and we could assert here.
Indeed but first we have to make sure that the CoordCache is properly
filled in for all insets. We can do that recursively as is done in the
rowpainter. One have to extract the part that calls setPosCache() and
transfer that in BufferView::updateMetris(). There is another to solve
this bug which might be easier. We just need to dissociate the pink
corner drawing from the text drawing. See my additional comment in bugzilla:
The CoordCache is being cleared because we need a full screen redraw. We
need
that full screen redraw for each cursor movement (via keyboard or mouse)
because
of the pink corner. Without the necessity for these corners, no metrics
update
would be needed and this bug would be naturally fixed. See my comments in
InsetMathNest::doDispatch():
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
If you can live without the corners, uncommenting the last line for each
of the
LFUN would solve the problem.
Here is