]> git.lyx.org Git - features.git/commitdiff
Fix loop while separating
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 13 Jan 2018 08:59:09 +0000 (09:59 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 13 Jan 2018 09:01:44 +0000 (10:01 +0100)
getMaxDepthAfter() gives wrong result here.

Fixes: #10979
Signed-off-by: Juergen Spitzmueller <spitz@lyx.org>
(cherry picked from commit bceaa7f92971f62014da43557815479d40adf551)

src/Text3.cpp

index 0eebbc026628e918738d766613c2c209c9122945..777f79fe47e4a4bc31ee12ef7b64b7de836d2c8f 100644 (file)
@@ -1555,9 +1555,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();
+                       depth_type const max_depth = cur.paragraph().params().depth() + 1;
                        cur.forwardPar();
-                       while (cur.paragraph().params().depth() <= min(nextpar_depth, max_depth))
+                       while (cur.paragraph().params().depth() < min(nextpar_depth, max_depth))
                                lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
                        cur.setCursor(scur);
                }