]> git.lyx.org Git - lyx.git/commitdiff
Do note attempt to nest more than possible.
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 4 Jan 2018 17:38:08 +0000 (18:38 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 4 Jan 2018 17:38:08 +0000 (18:38 +0100)
src/Text3.cpp

index ee7b88900b25a904879bafb57482ef5fe51fe5c8..0c5699ba329c61343727e12d3836de18309661ad 100644 (file)
@@ -1566,8 +1566,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                if ((outer || normal) && nextpar_depth > 0) {
                        // restore nesting of following paragraph
                        DocIterator scur = cur;
+                       depth_type const max_depth = cur.paragraph().getMaxDepthAfter();
                        cur.forwardPar();
-                       while (cur.paragraph().params().depth() < nextpar_depth)
+                       while (cur.paragraph().params().depth() <= min(nextpar_depth, max_depth))
                                lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
                        cur.setCursor(scur);
                }