[LyX/master] Fix issues with inset-dissolve in mathed

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Jul 23 14:26:01 UTC 2023


commit 0f7404392c2c710aa967a937f47eca0ad94cef93
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sun Jul 23 17:34:01 2023 +0200

    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 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 804ee4d..8bd0567 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: {


More information about the lyx-cvs mailing list