]> git.lyx.org Git - lyx.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>
Mon, 30 Dec 2019 12:32:24 +0000 (13:32 +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).

(cherry picked from commit 5ac3b880075794130492c2fe63c35104b207ad73)

src/insets/InsetTabular.cpp
src/insets/InsetText.cpp
status.23x

index 8ebb663025e385b5cfabe2f9ade14ada64c45944..ba00da7a644b8f3aa438601b8f2b8b4c9d039681 100644 (file)
@@ -3588,6 +3588,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 930ea1475c6405954d23623c2a8e322223b6eb15..da195b04ec71ed7cee40b18ee1b16746b58a41e3 100644 (file)
@@ -318,10 +318,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)
@@ -351,11 +349,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;
        }
 
index b08b2656ccd0721c8b37645db57c23a120c95ec4..22b9b5dd234cb76fd21c59934d28a4058f347e5a 100644 (file)
@@ -159,6 +159,8 @@ What's new
 
 - Enable dissolve in undefined Flex inset context menu (bug 8650).
 
+- Enable dissolve in context menu of element in table cells.
+
 - Fix bad caret position when row scrolls horizontally (bug 11603).
 
 - Fix crash when inserting some insets in math split insets  (bug 11686).