]> git.lyx.org Git - lyx.git/blobdiff - src/cursor.C
accept coordinates up to a million...
[lyx.git] / src / cursor.C
index 461777ececd8ae35c51f496166bbb6afa658eb16..0212621f350f0051545350774b4ec729da8b4b43 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "mathed/math_data.h"
 #include "mathed/math_inset.h"
+#include "mathed/math_scriptinset.h"
 #include "mathed/math_macrotable.h"
 
 #include "support/limited_stack.h"
@@ -96,7 +97,7 @@ namespace {
                for (int i = 0; ; ++i) {
                        int xo;
                        int yo;
-                       it.inset().cursorPos(it.top(), c.boundary(), xo, yo);
+                       it.inset().cursorPos(it.top(), c.boundary() && ((i+1) == it.depth()), xo, yo);
                        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'
@@ -915,10 +916,9 @@ bool LCursor::goUpDown(bool up)
                        MathScriptInset const * p = prevAtom()->asScriptInset();
                        if (p && p->has(up)) {
                                --pos();
-                               push(inset());
-                               idx() = up; // the superscript has index 1
+                               push(*const_cast<MathScriptInset*>(p));
+                               idx() = p->idxOfScript(up);
                                pos() = lastpos();
-                               //lyxerr << "updown: handled by scriptinset to the left" << endl;
                                return true;
                        }
                }
@@ -927,10 +927,9 @@ bool LCursor::goUpDown(bool up)
                if (pos() != lastpos()) {
                        MathScriptInset const * p = nextAtom()->asScriptInset();
                        if (p && p->has(up)) {
-                               push(inset());
-                               idx() = up;
+                               push(*const_cast<MathScriptInset*>(p));
+                               idx() = p->idxOfScript(up);
                                pos() = 0;
-                               //lyxerr << "updown: handled by scriptinset to the right" << endl;
                                return true;
                        }
                }