Revert "Fix crash when dissolving a top level math inset"

The code was too convoluted and actually wrong (the -1 should have been -2).

This reverts commit c75522bbb7.
This commit is contained in:
Jean-Marc Lasgouttes 2023-07-23 00:22:22 +02:00
parent 6d929e7139
commit 62d61e7655

View File

@ -1284,16 +1284,13 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
cur.undispatched();
break;
}
case LFUN_INSET_DISSOLVE: {
bool const enabled = cur.inMathed()
&& (&cur.inset() != this || cur[cur.depth() - 1].inset().inMathed());
if (enabled) {
case LFUN_INSET_DISSOLVE:
if (!asHullInset()) {
cur.recordUndoInset();
// FIXME: this loses data
cur.pullArg();
}
break;
}
case LFUN_MATH_LIMITS: {
InsetMath * in = 0;
if (cur.pos() < cur.lastpos() && cur.nextMath().allowsLimitsChange())
@ -1530,13 +1527,10 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
break;
}
case LFUN_INSET_DISSOLVE: {
// Do not dissolve a math inset which is in text
bool const enabled = cur.inMathed()
&& (&cur.inset() != this || cur[cur.depth() - 1].inset().inMathed());
flag.setEnabled(enabled);
case LFUN_INSET_DISSOLVE:
flag.setEnabled(!asHullInset());
break;
}
case LFUN_PASTE: {
docstring const & name = cmd.argument();
if (name == "html" || name == "latex")