Fix issues with inset-dissolve in mathed

* do not try to dissolve a macro template inset (avoids a crash)
* disable inset-dissolve when an argument is given
* when triggered by the AtPoint mechanism, make sur to dissolve the
  right inset.

Fixes bug #12562.
This commit is contained in:
Jean-Marc Lasgouttes 2023-07-23 17:34:01 +02:00
parent 62d61e7655
commit 0f7404392c

View File

@ -1285,7 +1285,10 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
break;
}
case LFUN_INSET_DISSOLVE:
if (!asHullInset()) {
if (cmd.argument().empty() && !asHullInset() && !asMacroTemplate()) {
// we have been triggered via the AtPoint mechanism
if (cur.nextInset() == this)
cur.push(*this);
cur.recordUndoInset();
cur.pullArg();
}
@ -1528,7 +1531,7 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
}
case LFUN_INSET_DISSOLVE:
flag.setEnabled(!asHullInset());
flag.setEnabled(cmd.argument().empty() && !asHullInset() && !asMacroTemplate());
break;
case LFUN_PASTE: {