]> git.lyx.org Git - features.git/commitdiff
Fix another old outliner bug (#9375)
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 22 Feb 2023 15:33:37 +0000 (16:33 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Wed, 22 Feb 2023 15:33:37 +0000 (16:33 +0100)
Parts, chapters and sections have different LabelTypes, but this does
not mean they cannot be transformed into each other while doing
OUTLINE_IN/OUT

Not sure why the labeltype check is here anyway, but let's keep it.

src/Layout.h
src/Text3.cpp

index 6efc5129f97ea97c5e1db94558868193b0e1d70e..6581155007860ce9dea4b0399cf69f49adb74d91 100644 (file)
@@ -292,6 +292,11 @@ public:
                        || labeltype == LABEL_CENTERED
                        || labeltype == LABEL_BIBLIO;
        }
+       bool isNumHeadingLabelType() const {
+               return labeltype == LABEL_ABOVE
+                       || labeltype == LABEL_CENTERED
+                       || labeltype == LABEL_STATIC;
+       }
        ///
        bool addToToc() const { return add_to_toc_; }
        ///
index 148b1d4f8bb53ded73420b51af2ecc37e19ebcde..d077dde7d2e9d61520c32dcdb022cd50f0a39dfd 100644 (file)
@@ -570,11 +570,11 @@ static void outline(OutlineOp mode, Cursor & cur, Text * text)
                                DocumentClass const & tc = buf.params().documentClass();
                                int const newtoclevel =
                                        (mode == OutlineIn ? toclevel + 1 : toclevel - 1);
-                               LabelType const oldlabeltype = start->layout().labeltype;
 
                                for (auto const & lay : tc) {
-                                       if (lay.toclevel ==  newtoclevel &&
-                                                lay.labeltype == oldlabeltype) {
+                                       if (lay.toclevel == newtoclevel
+                                           && lay.isNumHeadingLabelType()
+                                           && start->layout().isNumHeadingLabelType()) {
                                                start->setLayout(lay);
                                                break;
                                        }