From 32efb914384392426a4d909d1650edff727d8f15 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 4 Jan 2018 18:38:08 +0100 Subject: [PATCH] Do note attempt to nest more than possible. --- src/Text3.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index ee7b88900b..0c5699ba32 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -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); }