commit 92bfa07a6205e6e2aae486510c148582e11d6017
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Sep 19 10:19:19 2018 +0200

    Avoid infinite loop
    
    Fixes: #11295
---
 src/LyXAction.cpp |    2 +-
 src/Text3.cpp     |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp
index 43f4e80..39cad0d 100644
--- a/src/LyXAction.cpp
+++ b/src/LyXAction.cpp
@@ -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
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 918064c..9cef669 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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);
                }
 

Reply via email to