#include "mathed/InsetMath.h"
#include "mathed/InsetMathScript.h"
#include "mathed/MathMacroTable.h"
-#include "mathed/MathParser.h"
#include "support/limited_stack.h"
#include <sstream>
#include <limits>
+#include <map>
namespace lyx {
int xo;
int yo;
InsetBase const * inset = &it.inset();
- Point o = c.bv().coordCache().getInsets().xy(inset);
+ std::map<InsetBase const *, Point> const & data =
+ c.bv().coordCache().getInsets().getData();
+ std::map<InsetBase const *, Point>::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_;