]> git.lyx.org Git - features.git/commitdiff
Disable useless environment-split function at the core.
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 3 Jan 2018 12:16:07 +0000 (13:16 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 3 Jan 2018 12:19:24 +0000 (13:19 +0100)
(cherry picked from commit f965d23633916387cd48d228380f4a3172e61c2f)

src/Text3.cpp
src/frontends/qt4/Menus.cpp

index 9c4c7f9f7c36d9af51cd91a62f8a5b0769a5b86e..36ab59391078797f0128e4e8a5dc239a98c0d88a 100644 (file)
@@ -3232,7 +3232,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
                        break;
                }
                else if (cur.paragraph().layout().isEnvironment()) {
-                       enable = true;
+                       enable = cmd.argument() == "before"
+                               || cur.pos() > 0 || !isFirstInSequence(cur.pit());
                        break;
                }
                enable = false;
index 108d978f21b302250e23cb41f19efebfa44aabbe..d08517f00bf1ec4450c24b60e03338d092e4b320 100644 (file)
@@ -1865,7 +1865,6 @@ void MenuDefinition::expandEnvironmentSeparators(BufferView const * bv,
                return;
 
        pit_type pit = bv->cursor().selBegin().pit();
-       pos_type pos = bv->cursor().selBegin().pos();
        Paragraph const & par = text->getPar(pit);
        docstring const curlayout = par.layout().name();
        docstring outerlayout;
@@ -1898,18 +1897,17 @@ void MenuDefinition::expandEnvironmentSeparators(BufferView const * bv,
                add(MenuItem(MenuItem::Command, toqstr(label),
                             FuncRequest(LFUN_ENVIRONMENT_SPLIT,
                                         from_ascii("before"))));
-               if (!par.layout().keepempty || pos > 0 || !text->isFirstInSequence(pit)) {
-                       label = contextmenu ?
-                                       bformat(_("Insert Separated %1$s Below"),
-                                               translateIfPossible(curlayout)):
-                                       bformat(_("Separated %1$s Below"),
-                                               translateIfPossible(curlayout));
-                       // We use command-alternatives here since this is how the binding is defined
-                       // (otherwise, the binding is not displayed in the menu)
+               label = contextmenu ?
+                               bformat(_("Insert Separated %1$s Below"),
+                                       translateIfPossible(curlayout)):
+                               bformat(_("Separated %1$s Below"),
+                                       translateIfPossible(curlayout));
+               // We use command-alternatives here since this is how the binding is defined
+               // (otherwise, the binding is not displayed in the menu)
+               if (getStatus(FuncRequest(LFUN_ENVIRONMENT_SPLIT)).enabled())
                        add(MenuItem(MenuItem::Command, toqstr(label),
                                     FuncRequest(LFUN_COMMAND_ALTERNATIVES,
                                                 from_ascii("environment-split ; environment-split previous"))));
-               }
        }
        else if (!prevlayout.empty()) {
                docstring const label = contextmenu ?