]> git.lyx.org Git - features.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>
Thu, 20 Sep 2018 15:01:38 +0000 (17:01 +0200)
Fixes: #11295
(cherry picked from commit 92bfa07a6205e6e2aae486510c148582e11d6017)

src/LyXAction.cpp
src/Text3.cpp
status.23x

index 9c027963caf5fa22c10a058d00fb618f19591b32..35ae6aae87b5ea30b3218f85dcb031f84de5178f 100644 (file)
@@ -1517,9 +1517,9 @@ 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
-               before: If this is given, the new environment will be appended rather than
-                      prepended.
+                         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
  * \endvar
  */
index 2158128891b220ad0650960e597283a993f0b2fd..b86819b237328f2762118890de3664f91bb40286 100644 (file)
@@ -1654,8 +1654,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);
                }
 
index d149b701ef79ea46885d7e1b4cc9e92e1bafcac0..ceab95d4e64a48f3d3964e2209b20e96f81b1507 100644 (file)
@@ -108,6 +108,8 @@ What's new
 
 * USER INTERFACE
 
+- Fix infinite loop while separating environments (bug 11295).
+
 - Fix loss of citation list after Undo (bug 9158).
 
 - Fix document-wide language setting with minted (bug 11203).
@@ -120,7 +122,7 @@ What's new
 
 - 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).