X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathScript.cpp;h=c146e071b15e7fc9008d1e2d99c63c420e401b1f;hb=11a6b3c4c7a031fd3776f53c9c43f62116933cea;hp=246695e043321b94b73581fa860d80bf2b5bf6db;hpb=c4b009a24858a96f7672a11595c9fb1e6e7bc63c;p=lyx.git diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp index 246695e043..c146e071b1 100644 --- a/src/mathed/InsetMathScript.cpp +++ b/src/mathed/InsetMathScript.cpp @@ -695,9 +695,9 @@ bool InsetMathScript::notifyCursorLeaves(Cursor & cur) int scriptSlice = cur.bv().cursor().find(this); BOOST_ASSERT(scriptSlice != -1); - Cursor scriptCur = cur.bv().cursor(); - scriptCur.cutOff(scriptSlice); - scriptCur.recordUndoInset(); + Cursor & bvCur = cur.bv().cursor(); + bvCur.cutOff(scriptSlice); + bvCur.recordUndoInset(); // Let the script inset commit suicide. This is // modelled on Cursor.pullArg(), but tries not to @@ -705,9 +705,14 @@ bool InsetMathScript::notifyCursorLeaves(Cursor & cur) // cur (since the top slice will be deleted // afterwards) MathData ar = cell(0); - scriptCur.pop(); - scriptCur.cell().erase(scriptCur.pos()); - scriptCur.cell().insert(scriptCur.pos(), ar); + bvCur.pop(); + bvCur.cell().erase(bvCur.pos()); + bvCur.cell().insert(bvCur.pos(), ar); + + // put cursor behind + bvCur.pos() += ar.size(); + + // redraw cur.updateFlags(cur.disp_.update() | Update::SinglePar); return true; }