X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fcursor.C;h=4d95d0de0b632c4c3d09b0f0b0c3f2741f21616d;hb=e5b8f6956160631022fede155f55bad7951eecb8;hp=24befe6a994b459e7029ce94ce090fcf7f4869b3;hpb=78808418888af2ecab9da4b36db95c32b95fb13d;p=lyx.git diff --git a/src/cursor.C b/src/cursor.C index 24befe6a99..4d95d0de0b 100644 --- a/src/cursor.C +++ b/src/cursor.C @@ -39,7 +39,6 @@ #include "mathed/InsetMath.h" #include "mathed/InsetMathScript.h" #include "mathed/MathMacroTable.h" -#include "mathed/MathParser.h" #include "support/limited_stack.h" @@ -49,6 +48,7 @@ #include #include +#include namespace lyx { @@ -96,7 +96,20 @@ namespace { int xo; int yo; InsetBase const * inset = &it.inset(); - Point o = c.bv().coordCache().getInsets().xy(inset); + std::map const & data = + c.bv().coordCache().getInsets().getData(); + std::map::const_iterator I = data.find(inset); + + // FIXME: in the case where the inset is not in the cache, this + // means that no part of it is visible on screen. In this case + // we don't do elaborate search and we just return the forwarded + // DocIterator at its beginning. + if (I == data.end()) { + it.top().pos() = 0; + return it; + } + + Point o = I->second; inset->cursorPos(c.bv(), it.top(), c.boundary(), xo, yo); // Convert to absolute xo += o.x_;