]> git.lyx.org Git - features.git/commitdiff
Disable inset-dissolve in table cells
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 4 Dec 2019 14:56:30 +0000 (15:56 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 6 Dec 2019 08:54:43 +0000 (09:54 +0100)
This is better than making sure that the inset has exactly one cell.

In the future, inset-dissolve could be extended to dissolve all the
cells contents in the enclosing text.

Note that this check does not appear in mathed, and using dissolve in
e.g. fraction inset may lead to data loss (only current cell contents
is preserved).

src/insets/InsetTabular.cpp
src/insets/InsetText.cpp

index edd96a5c9b105e7345a6e1038670e52b6ad8986c..c59f6427a0b952a2e04a7873ad108f72c49ca2a1 100644 (file)
@@ -3989,6 +3989,9 @@ bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
 {
        bool enabled = true;
        switch (cmd.action()) {
+       case LFUN_INSET_DISSOLVE:
+               enabled = false;
+               break;
        case LFUN_MATH_DISPLAY:
                if (!hasFixedWidth()) {
                        enabled = false;
index c7757f1673006b91da449ae35b173234b2c150ec..2126fb15b2f6a94f87a4e5e8b66143bfd76dd7a2 100644 (file)
@@ -317,10 +317,8 @@ void InsetText::doDispatch(Cursor & cur, FuncRequest & cmd)
                bool const main_inset = text_.isMainText();
                bool const target_inset = cmd.argument().empty()
                        || cmd.getArg(0) == insetName(lyxCode());
-               // cur.inset() is the tabular when this is a single cell (bug #9954)
-               bool const one_cell = cur.inset().nargs() == 1;
 
-               if (!main_inset && target_inset && one_cell) {
+               if (!main_inset && target_inset) {
                        // Text::dissolveInset assumes that the cursor
                        // is inside the Inset.
                        if (&cur.inset() != this)
@@ -350,11 +348,9 @@ bool InsetText::getStatus(Cursor & cur, FuncRequest const & cmd,
                bool const main_inset = text_.isMainText();
                bool const target_inset = cmd.argument().empty()
                        || cmd.getArg(0) == insetName(lyxCode());
-               // cur.inset() is the tabular when this is a single cell (bug #9954)
-               bool const one_cell = cur.inset().nargs() == 1;
 
                if (target_inset)
-                       status.setEnabled(!main_inset && one_cell);
+                       status.setEnabled(!main_inset);
                return target_inset;
        }