commit 62d61e765582f6fa297d933282938b127bf47f04
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Sun Jul 23 00:22:22 2023 +0200

    Revert "Fix crash when dissolving a top level math inset"
    
    The code was too convoluted and actually wrong (the -1 should have been -2).
    
    This reverts commit c75522bbb7a0044f2370ced294a27738d47935ea.
---
 src/mathed/InsetMathNest.cpp |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index a780a95..804ee4d 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1284,16 +1284,13 @@ void InsetMathNest::doDispatch(Cursor & cur, 
FuncRequest & cmd)
                        cur.undispatched();
                break;
        }
-       case LFUN_INSET_DISSOLVE: {
-               bool const enabled = cur.inMathed()
-                       && (&cur.inset() != this || cur[cur.depth() - 
1].inset().inMathed());
-               if (enabled) {
+       case LFUN_INSET_DISSOLVE:
+               if (!asHullInset()) {
                        cur.recordUndoInset();
-                       // FIXME: this loses data
                        cur.pullArg();
                }
                break;
-       }
+
        case LFUN_MATH_LIMITS: {
                InsetMath * in = 0;
                if (cur.pos() < cur.lastpos() && 
cur.nextMath().allowsLimitsChange())
@@ -1530,13 +1527,10 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest 
const & cmd,
                break;
        }
 
-       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);
+       case LFUN_INSET_DISSOLVE:
+               flag.setEnabled(!asHullInset());
                break;
-       }
+
        case LFUN_PASTE: {
                docstring const & name = cmd.argument();
                if (name == "html" || name == "latex")
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to