xo = targetx_;
// try neigbouring script insets
- // try left
- if (hasPrevAtom()) {
- MathScriptInset const * p = prevAtom()->asScriptInset();
- if (p && p->has(up)) {
- --pos();
- push(nextAtom());
- idx() = up; // the superscript has index 1
- pos() = size();
- ///lyxerr << "updown: handled by scriptinset to the left" << endl;
- return true;
+ if (!selection()) {
+ // try left
+ if (hasPrevAtom()) {
+ MathScriptInset const * p = prevAtom()->asScriptInset();
+ if (p && p->has(up)) {
+ --pos();
+ push(nextAtom());
+ idx() = up; // the superscript has index 1
+ pos() = size();
+ //lyxerr << "updown: handled by scriptinset to the left" << endl;
+ return true;
+ }
}
- }
- // try right
- if (hasNextAtom()) {
- MathScriptInset const * p = nextAtom()->asScriptInset();
- if (p && p->has(up)) {
- push(nextAtom());
- idx() = up;
- pos() = 0;
- ///lyxerr << "updown: handled by scriptinset to the right" << endl;
- return true;
+ // try right
+ if (hasNextAtom()) {
+ MathScriptInset const * p = nextAtom()->asScriptInset();
+ if (p && p->has(up)) {
+ push(nextAtom());
+ idx() = up;
+ pos() = 0;
+ //lyxerr << "updown: handled by scriptinset to the right" << endl;
+ return true;
+ }
}
}
// try to find an inset that knows better then we
while (1) {
- ///lyxerr << "updown: We are in " << *inset() << " idx: " << idx() << endl;
+ //lyxerr << "updown: We are in " << inset() << " idx: " << idx() << endl;
// ask inset first
if (inset()->idxUpDown(idx(), pos(), up, targetx_)) {
// try to find best position within this inset
}
// no such inset found, just take something "above"
- ///lyxerr << "updown: handled by strange case" << endl;
+ //lyxerr << "updown: handled by strange case" << endl;
if (!popLeft())
return
bruteFind(xo, yo,
bool operator<(CursorPos const & p, CursorPos const & q)
{
if (p.inset_ != q.inset_) {
- lyxerr << "can't compare cursor and anchor in different insets"
- << endl;
+ lyxerr << "can't compare cursor and anchor in different insets\n"
+ << "p: " << p << '\n' << "q: " << q << endl;
return true;
}
if (p.idx_ != q.idx_)