]> git.lyx.org Git - features.git/commitdiff
Don't show append function where it does not make sense.
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 30 Dec 2017 16:04:10 +0000 (17:04 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 30 Dec 2017 16:04:10 +0000 (17:04 +0100)
src/frontends/qt4/Menus.cpp

index 8daec7d5de23a91991fbfc94698f5d3c15b928c0..22c8e9456b4dbbcad694a92ce830b649f73af94e 100644 (file)
@@ -1856,6 +1856,7 @@ 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;
@@ -1885,10 +1886,12 @@ void MenuDefinition::expandEnvironmentSeparators(BufferView const * bv)
                add(MenuItem(MenuItem::Command, toqstr(label),
                             FuncRequest(LFUN_ENVIRONMENT_SPLIT,
                                         from_ascii("before"))));
-               label = bformat(_("Append New Environment (%1$s)"),
-                               translateIfPossible(curlayout));
-               add(MenuItem(MenuItem::Command, toqstr(label),
-                            FuncRequest(LFUN_ENVIRONMENT_SPLIT)));
+               if (!par.layout().keepempty || pos > 0 || !text->isFirstInSequence(pit)) {
+                       label = bformat(_("Append New Environment (%1$s)"),
+                                       translateIfPossible(curlayout));
+                       add(MenuItem(MenuItem::Command, toqstr(label),
+                                    FuncRequest(LFUN_ENVIRONMENT_SPLIT)));
+               }
        }
        else if (!prevlayout.empty()) {
                docstring const label =