[LyX/master] Preserve paragraph depth when dissolving.

Jean-Marc Lasgouttes lasgouttes at lyx.org
Thu Dec 10 17:05:20 UTC 2020


commit 69c46c56fe7c1f67ea89c3863fd19299fa335b65
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Thu Dec 10 18:34:07 2020 +0100

    Preserve paragraph depth when dissolving.
    
    It turns out that makeSameLayout() does more than we want.
    
    Fixes bug #11981.
---
 src/Text.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index d1e0d9a..d227bd5 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -1868,9 +1868,15 @@ bool Text::dissolveInset(Cursor & cur)
 		 */
 		DocumentClass const & tclass = cur.buffer()->params().documentClass();
 		if (inset_it.lastpos() == 1
-			&& !tclass.isPlainLayout(plist[0].layout())
-			&& !tclass.isDefaultLayout(plist[0].layout()))
-			cur.paragraph().makeSameLayout(plist[0]);
+		    && !tclass.isPlainLayout(plist[0].layout())
+		    && !tclass.isDefaultLayout(plist[0].layout())) {
+			// Copy all parameters except depth.
+			Paragraph & par = cur.paragraph();
+			par.setLayout(plist[0].layout());
+			depth_type const dpth = par.getDepth();
+			par.params() = plist[0].params();
+			par.params().depth(dpth);
+		}
 
 		pasteParagraphList(cur, plist, b.params().documentClassPtr(),
 				   b.errorList("Paste"));


More information about the lyx-cvs mailing list