X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_scriptinset.C;h=cf23765572186e00b490bb7606b1210e4e5316e8;hb=701b99ecd70ac472aa53c8b2317af44def4f9670;hp=98a950e80916de933920bee820bcf1f0d1f98d99;hpb=ec744e7583d8bf642ed5f66321fd5845ba213a18;p=lyx.git diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 98a950e809..cf23765572 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -47,8 +47,7 @@ MathScriptInset::MathScriptInset(MathAtom const & at, bool up) } - -auto_ptr MathScriptInset::clone() const +auto_ptr MathScriptInset::doClone() const { return auto_ptr(new MathScriptInset(*this)); } @@ -305,12 +304,12 @@ bool MathScriptInset::hasLimits() const void MathScriptInset::removeScript(bool up) { - lyxerr << "MathNestInset::removeScript: 1 up: " << up << endl; + lyxerr << "MathScriptInset::removeScript: 1 up: " << up << endl; if (nargs() == 2) { - lyxerr << "MathNestInset::removeScript: a up: " << up << endl; + lyxerr << "MathScriptInset::removeScript: a up: " << up << endl; if (up == cell_1_is_up_) cells_.pop_back(); - lyxerr << "MathNestInset::removeScript: b up: " << up << endl; + lyxerr << "MathScriptInset::removeScript: b up: " << up << endl; } else if (nargs() == 3) { if (up == true) { swap(cells_[1], cells_[2]); @@ -320,7 +319,7 @@ void MathScriptInset::removeScript(bool up) } cells_.pop_back(); } - lyxerr << "MathNestInset::removeScript: 2 up: " << up << endl; + lyxerr << "MathScriptInset::removeScript: 2 up: " << up << endl; } @@ -557,39 +556,24 @@ void MathScriptInset::notifyCursorLeaves(LCursor & cur) { MathNestInset::notifyCursorLeaves(cur); -#if 1 + lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl; + // remove empty scripts if possible -<<<<<<< math_scriptinset.C - if (cur.idx() == 2 && cell(2).empty()) { +if (1) { + if (nargs() > 2 && cur.idx() == 2 && cell(2).empty()) { // must be a subscript... removeScript(false); - // sanitize cursor, even if this slice will be removed immediately - cur.idx() = 0; - cur.pos() = 0; - } else if (cur.idx() == 1 && cell(1).empty()) { + } else if (nargs() > 1 && cur.idx() == 1 && cell(1).empty()) { // could be either subscript or super script removeScript(cell_1_is_up_); - // sanitize cursor, even if this slice will be removed immediately - cur.idx() = 0; - cur.pos() = 0; -======= - if (idx == 2 && nargs() > 2 && cell(2).empty()) { - removeScript(false); // must be a subscript... - } else if (idx == 1 && nargs() > 1 && cell(1).empty()) { - if (nargs() == 2) { - cell_1_is_up_ = false; - cell(1) = cell(2); - cells_.pop_back(); - } else if (nargs() == 1) { - cells_.pop_back(); - } ->>>>>>> 1.114 } -#endif +} + + lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl; } -void MathScriptInset::priv_dispatch(LCursor & cur, FuncRequest & cmd) +void MathScriptInset::doDispatch(LCursor & cur, FuncRequest & cmd) { //lyxerr << "MathScriptInset: request: " << cmd << std::endl; @@ -608,5 +592,5 @@ void MathScriptInset::priv_dispatch(LCursor & cur, FuncRequest & cmd) return; } - MathNestInset::priv_dispatch(cur, cmd); + MathNestInset::doDispatch(cur, cmd); }