]> git.lyx.org Git - features.git/commitdiff
Preserve paragraph depth when dissolving.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 10 Dec 2020 17:34:07 +0000 (18:34 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 10 Dec 2020 17:34:07 +0000 (18:34 +0100)
It turns out that makeSameLayout() does more than we want.

Fixes bug #11981.

src/Text.cpp

index d1e0d9abd0769cb8ef3543f9da24a83c62e2c1e1..d227bd5cd5af108f1072a0d0ec168aa058219edf 100644 (file)
@@ -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"));