[LyX/master] Fixup e1be71da: do not enforce plain layout when dissolving

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Dec 6 09:07:55 UTC 2019


commit 2e784b2f061d23f179b263d685789526e5872ea8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Fri Dec 6 10:20:18 2019 +0100

    Fixup e1be71da: do not enforce plain layout when dissolving
    
    Instead of checking whether the dissolved inset enforces plain layout,
    it is better to check whether is uses plain layout.
    
    Fixes #10369.
---
 src/Text.cpp |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 1fdef6e..e060a6c 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -1820,14 +1820,16 @@ bool Text::dissolveInset(Cursor & cur)
 		for (; it != it_end; ++it)
 			it->changeLanguage(b.params(), latex_language, b.language());
 
-		/* the inset is the only thing in paragraph, then the layout
-		 * of the first paragraph of inset should be remembered.
+		/* If the inset is the only thing in paragraph and the layout
+		 * is not plain, then the layout of the first paragraph of
+		 * inset should be remembered.
 		 * FIXME: this does not work as expected when change tracking
 		 *   is on However, we do not really know what to do in this
 		 *   case.
 		 */
+		DocumentClass const & tclass = cur.buffer()->params().documentClass();
 		if (inset_it.lastpos() == 1
-		    && inset_it.nextInset() && !inset_it.nextInset()->forcePlainLayout())
+		    && plist[0].layout().name() != tclass.plainLayoutName())
 			cur.paragraph().makeSameLayout(plist[0]);
 
 		pasteParagraphList(cur, plist, b.params().documentClassPtr(),


More information about the lyx-cvs mailing list