Do note attempt to nest more than possible.

(cherry picked from commit 32efb91438)
This commit is contained in:
Juergen Spitzmueller 2018-01-04 18:38:08 +01:00
parent 7668633b94
commit cf97ec4a21

View File

@ -1554,8 +1554,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
if ((outer || normal) && nextpar_depth > 0) { if ((outer || normal) && nextpar_depth > 0) {
// restore nesting of following paragraph // restore nesting of following paragraph
DocIterator scur = cur; DocIterator scur = cur;
depth_type const max_depth = cur.paragraph().getMaxDepthAfter();
cur.forwardPar(); 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)); lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
cur.setCursor(scur); cur.setCursor(scur);
} }