commit 2da183bf4f69847e30c9c9ab8a32548432a8a8b1
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Mon Jan 24 19:19:46 2022 +0100

    Check layout type when inserting inset over selection
    
    When inserting inset over a selection, the layout is transferred if
    the inset covers full paragraphs.
    
    This is not the right policy in the case of environments. Until proper
    code is written and tested, limit ourselves to command layouts.
    
    Fixes bug #12251.
---
 src/Text3.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index a87169b..529e756 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -299,8 +299,11 @@ static bool doInsertInset(Cursor & cur, Text * text,
                         * paragraph and the inset allows setting layout
                         * FIXME: this does not work as expected when change 
tracking is on
                         *   However, we do not really know what to do in this 
case.
+                        * FIXME: figure out a good test in the environment 
case (see #12251).
                         */
-                       if (cur.paragraph().empty() && 
!inset->forcePlainLayout()) {
+                       if (cur.paragraph().layout().isCommand()
+                            && cur.paragraph().empty()
+                            && !inset->forcePlainLayout()) {
                                
cur.paragraph().setPlainOrDefaultLayout(bparams.documentClass());
                                move_layout = true;
                        }
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to