]> git.lyx.org Git - features.git/commitdiff
Allow inserting a blank line also after a nested environment.
authorEnrico Forestieri <forenr@lyx.org>
Mon, 26 May 2014 19:29:33 +0000 (21:29 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 26 May 2014 19:29:33 +0000 (21:29 +0200)
src/Text3.cpp

index 707a4e204dec6b784f389567913a3e6dac56bdc9..b78ba15ce98d7b598e25b15f1a18562c5bdff722 100644 (file)
@@ -1071,15 +1071,20 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                cap::replaceSelection(cur);
                pit_type pit = cur.pit();
                Paragraph const & par = pars_[pit];
-               pit_type prev =
-                       pit > 0 && pars_[pit - 1].getDepth() >= par.getDepth() ?
-                       depthHook(pit, par.getDepth()) : pit;
+               pit_type prev = pit;
+               if (pit > 0) {
+                       if (!pars_[pit - 1].layout().isEnvironment())
+                               prev = depthHook(pit, par.getDepth());
+                       else if (pars_[pit - 1].getDepth() >= par.getDepth())
+                               prev = pit - 1;
+               }
                if (prev < pit && cur.pos() == par.beginOfBody()
                    && !par.isEnvSeparator(cur.pos())
                    && !par.layout().isCommand()
                    && pars_[prev].layout() != par.layout()
                    && pars_[prev].layout().isEnvironment()) {
-                       if (par.layout().isEnvironment()) {
+                       if (par.layout().isEnvironment()
+                           && pars_[prev].getDepth() == par.getDepth()) {
                                docstring const layout = par.layout().name();
                                DocumentClass const & tc = bv->buffer().params().documentClass();
                                lyx::dispatch(FuncRequest(LFUN_LAYOUT, tc.plainLayout().name()));