From 62d61e765582f6fa297d933282938b127bf47f04 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 23 Jul 2023 00:22:22 +0200 Subject: [PATCH] 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 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index a780a95fb6..804ee4d002 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") -- 2.39.5