From 0f7404392c2c710aa967a937f47eca0ad94cef93 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 23 Jul 2023 17:34:01 +0200 Subject: [PATCH] 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. --- src/mathed/InsetMathNest.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 804ee4d002..8bd05679c3 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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: { -- 2.39.5