Avoid infinite loop

Fixes: #11295
(cherry picked from commit 92bfa07a6205e6e2aae486510c148582e11d6017)
This commit is contained in:
Juergen Spitzmueller 2018-09-19 10:19:19 +02:00
parent 2f4323e278
commit bebb077955
3 changed files with 12 additions and 5 deletions

View File

@ -1517,7 +1517,7 @@ void LyXAction::init()
* \li Params: outer: If this is given, LyX will split the outermost environment in * \li Params: outer: If this is given, LyX will split the outermost environment in
the current nesting hierarchy.\n the current nesting hierarchy.\n
previous: If this is given, LyX will split the environment in the previous previous: If this is given, LyX will split the environment in the previous
paragraph (is there is one).\n paragraph (if there is one).\n
before: If this is given, the new environment will be appended rather than before: If this is given, the new environment will be appended rather than
prepended. prepended.
* \li Origin: spitz, 23 Dec 2012 * \li Origin: spitz, 23 Dec 2012

View File

@ -1654,8 +1654,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
DocIterator scur = cur; DocIterator scur = cur;
depth_type const max_depth = cur.paragraph().params().depth() + 1; depth_type const max_depth = cur.paragraph().params().depth() + 1;
cur.forwardPar(); cur.forwardPar();
while (cur.paragraph().params().depth() < min(nextpar_depth, max_depth)) while (cur.paragraph().params().depth() < min(nextpar_depth, max_depth)) {
depth_type const olddepth = cur.paragraph().params().depth();
lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT)); lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
if (olddepth == cur.paragraph().params().depth())
// leave loop if no incrementation happens
break;
}
cur.setCursor(scur); cur.setCursor(scur);
} }

View File

@ -108,6 +108,8 @@ What's new
* USER INTERFACE * USER INTERFACE
- Fix infinite loop while separating environments (bug 11295).
- Fix loss of citation list after Undo (bug 9158). - Fix loss of citation list after Undo (bug 9158).
- Fix document-wide language setting with minted (bug 11203). - Fix document-wide language setting with minted (bug 11203).
@ -120,7 +122,7 @@ What's new
- Draw menu separator symbol according to text direction. - Draw menu separator symbol according to text direction.
- Improve automatic removal of extra spaces, aka DEPM (bug 10503) - Improve automatic removal of extra spaces, aka DEPM (bug 10503).