]> git.lyx.org Git - lyx.git/blobdiff - src/cursor.C
fix nullstream also in pch files
[lyx.git] / src / cursor.C
index a17317858194b3897017b8601d3a778e48c19568..b9e0c54382cda9f9dcdf181cf6ac896b72865152 100644 (file)
@@ -97,7 +97,12 @@ namespace {
                for (size_t i = 0; ; ++i) {
                        int xo;
                        int yo;
-                       it.inset().cursorPos(it.top(), c.boundary() && ((i+1) == it.depth()), xo, yo);
+                       InsetBase const * inset = &it.inset();
+                       Point o = theCoords.getInsets().xy(inset);
+                       inset->cursorPos(it.top(), c.boundary(), xo, yo);
+                       // Convert to absolute
+                       xo += o.x_;
+                       yo += o.y_;
                        double d = (x - xo) * (x - xo) + (y - yo) * (y - yo);
                        // '<=' in order to take the last possible position
                        // this is important for clicking behind \sum in e.g. '\sum_i a'
@@ -128,7 +133,7 @@ namespace {
                double best_dist = std::numeric_limits<double>::max();;
                DocIterator best_cursor = et;
 
-               for ( ; it != et; it.forwardPos()) {
+               for ( ; it != et; it.forwardPos(true)) {
                        // avoid invalid nesting when selecting
                        if (bv_funcs::status(&cursor.bv(), it) == bv_funcs::CUR_INSIDE
                            && (!cursor.selection() || positionable(it, cursor.anchor_))) {
@@ -374,6 +379,8 @@ void LCursor::getPos(int & x, int & y) const
 }
 
 
+// Don't use this routine. It is erroneous: LFUN_PASTE should be called with
+// buffer number, not data to be inserted -- MV 26.02.2006
 void LCursor::paste(string const & data)
 {
        if (!data.empty())
@@ -707,7 +714,10 @@ void LCursor::niceInsert(MathAtom const & t)
                // be careful here: don't use 'pushLeft(t)' as this we need to
                // push the clone, not the original
                pushLeft(*nextInset());
-               paste(safe);
+               // We may not use niceInsert here (recursion)
+               MathArray ar;
+               asArray(safe, ar);
+               insert(ar);
        }
 }