X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathNest.C;h=49867f7fe3ba1612c39b4dfde4b3f981f5adc91d;hb=78808418888af2ecab9da4b36db95c32b95fb13d;hp=1596e95794817a1903d320aab7f5955a36ae9456;hpb=73ed0b5203ffefa9a4c2ad8e8cf54396a6e72a9c;p=lyx.git diff --git a/src/mathed/InsetMathNest.C b/src/mathed/InsetMathNest.C index 1596e95794..49867f7fe3 100644 --- a/src/mathed/InsetMathNest.C +++ b/src/mathed/InsetMathNest.C @@ -52,7 +52,6 @@ #include "frontends/Painter.h" #include "frontends/Selection.h" -#include "frontends/nullpainter.h" #include "funcrequest.h" #include "lyxserver.h" @@ -649,7 +648,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd) recordUndoInset(cur, Undo::ATOMIC); else recordUndo(cur, Undo::ATOMIC); - cur.backspace(); + // if the inset can not be removed from within, delete it + if (!cur.backspace()) { + FuncRequest cmd = FuncRequest(LFUN_CHAR_DELETE_FORWARD); + cur.bv().getLyXText()->dispatch(cur, cmd); + } break; case LFUN_WORD_DELETE_FORWARD: @@ -659,7 +662,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd) recordUndoInset(cur, Undo::ATOMIC); else recordUndo(cur, Undo::ATOMIC); - cur.erase(); + // if the inset can not be removed from within, delete it + if (!cur.erase()) { + FuncRequest cmd = FuncRequest(LFUN_CHAR_DELETE_FORWARD); + cur.bv().getLyXText()->dispatch(cur, cmd); + } break; case LFUN_ESCAPE: @@ -1404,11 +1411,7 @@ bool InsetMathNest::script(LCursor & cur, bool up, } --cur.pos(); InsetMathScript * inset = cur.nextAtom().nucleus()->asScriptInset(); - // special handling of {}-bases - // is this always correct? - if (inset->nuc().size() == 1 - && inset->nuc().back()->asBraceInset()) - inset->nuc() = inset->nuc().back()->asNestInset()->cell(0); + // See comment in MathParser.C for special handling of {}-bases cur.push(*inset); cur.idx() = 1;