commit c75522bbb7a0044f2370ced294a27738d47935ea
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Wed Jun 29 22:52:16 2022 +0200
Fix crash when dissolving a top level math inset
This should be disabled not only for math hull, but also macro template.
Fixes bug #12562.
---
src/mathed/InsetMathNest.cpp | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index cfa5aaf..05920cc 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1275,13 +1275,16 @@ void InsetMathNest::doDispatch(Cursor & cur,
FuncRequest & cmd)
cur.undispatched();
break;
}
- case LFUN_INSET_DISSOLVE:
- if (!asHullInset()) {
+ case LFUN_INSET_DISSOLVE: {
+ bool const enabled = cur.inMathed()
+ && (&cur.inset() != this || cur[cur.depth() -
1].inset().inMathed());
+ if (enabled) {
cur.recordUndoInset();
+ // FIXME: this loses data
cur.pullArg();
}
break;
-
+ }
case LFUN_MATH_LIMITS: {
InsetMath * in = 0;
if (cur.pos() < cur.lastpos() &&
cur.nextMath().allowsLimitsChange())
@@ -1497,10 +1500,13 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest
const & cmd,
break;
}
- case LFUN_INSET_DISSOLVE:
- flag.setEnabled(!asHullInset());
+ 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);
break;
-
+ }
case LFUN_PASTE: {
docstring const & name = cmd.argument();
if (name == "html" || name == "latex")
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs