]> git.lyx.org Git - lyx.git/commitdiff
Fix issues with inset-dissolve in mathed
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 23 Jul 2023 15:34:01 +0000 (17:34 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 23 Jul 2023 15:39:39 +0000 (17:39 +0200)
* 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

index 804ee4d002de84c9ab2558674a00dfe2b4a7e39b..8bd05679c335cd83a1d3aa84e9bb4f78c9deccce 100644 (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: {