commit bebb077955994e872d1ff7eec18168163beb0c38
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Wed Sep 19 10:19:19 2018 +0200

    Avoid infinite loop
    
    Fixes: #11295
    (cherry picked from commit 92bfa07a6205e6e2aae486510c148582e11d6017)
---
 src/LyXAction.cpp |    6 +++---
 src/Text3.cpp     |    7 ++++++-
 status.23x        |    4 +++-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 9c02796..35ae6aa 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -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
  */
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 2158128..b86819b 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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);
                }
 
diff --git a/status.23x b/status.23x
index d149b70..ceab95d 100644
--- a/status.23x
+++ b/status.23x
@@ -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).
 
 
 

Reply via email to