]> git.lyx.org Git - lyx.git/commitdiff
Avoid infinite loop
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 19 Sep 2018 08:19:19 +0000 (10:19 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 19 Sep 2018 08:19:19 +0000 (10:19 +0200)
Fixes: #11295
src/LyXAction.cpp
src/Text3.cpp

index 43f4e80a9988d247cff2eb5e3486c34a601b1a1c..39cad0d0d4df4a83e38623a56dcacbf5cf449edb 100644 (file)
@@ -1517,7 +1517,7 @@ void LyXAction::init()
  * \li Params: outer:    If this is given, LyX will split the outermost environment in
                          the current nesting hierarchy.\n
                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
                          prepended.
  * \li Origin: spitz, 23 Dec 2012
index 918064c3363728a5306a07689724b399eb21fe77..9cef6692b44812c60fc82a6f1f7493785e8a82d7 100644 (file)
@@ -1663,8 +1663,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        DocIterator scur = cur;
                        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)) {
+                               depth_type const olddepth = cur.paragraph().params().depth();
                                lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
+                               if (olddepth == cur.paragraph().params().depth())
+                                       // leave loop if no incrementation happens
+                                       break;
+                       }
                        cur.setCursor(scur);
                }