]> git.lyx.org Git - features.git/commitdiff
Don't parse multicolumn if the grid does not support it
authorGuillaume Munch <gm@lyx.org>
Thu, 3 Nov 2016 22:23:11 +0000 (23:23 +0100)
committerGuillaume Munch <gm@lyx.org>
Sat, 5 Nov 2016 17:36:39 +0000 (18:36 +0100)
Fixes #10466 and visual/compilation bugs with InsetMathSplit, InsetMathDiagram,
InsetMathHull, InsetMathSubstack and InsetMathXYMatrix.

src/mathed/InsetMathAMSArray.h
src/mathed/InsetMathArray.h
src/mathed/InsetMathCases.h
src/mathed/InsetMathGrid.h
src/mathed/InsetMathHull.cpp
src/mathed/InsetMathMatrix.h
src/mathed/InsetMathSplit.cpp
src/mathed/InsetMathTabular.h
src/mathed/MathParser.cpp

index 584397302dc44ebb9fbd8cc0e446c6990a432cfb..c337c781a06a7151097ec4c241756d8617211e1e 100644 (file)
@@ -58,6 +58,8 @@ public:
        int leftMargin() const { return 6; } //override
        ///
        int rightMargin() const { return 8; } //override
+       ///
+       bool handlesMulticolumn() const { return true; } //override
 
 private:
        virtual Inset * clone() const;
index a3875e58b7409279cbde4126a1252a688b7f982b..b1cc3110abd0da5be86150b6e90514db4a1e8758 100644 (file)
@@ -53,6 +53,8 @@ public:
        int leftMargin() const { return 4; } //override
        ///
        int rightMargin() const { return 2; } //override
+       ///
+       bool handlesMulticolumn() const { return true; } //override
 
 private:
        virtual Inset * clone() const;
index 3b44b823ca041a8bb3a698ac5e67639da4f5d2c3..84e13979e8ba9226a94a4e3e0e1598f5542855d4 100644 (file)
@@ -56,6 +56,8 @@ public:
        int leftMargin() const { return 8; } //override
        ///
        int rightMargin() const { return 0; } //override
+       /// see e.g. https://tex.stackexchange.com/a/133283/87201
+       bool handlesMulticolumn() const { return true; } //override
 
 private:
        virtual Inset * clone() const;
index 61e7e235c8a7cbe3b1294bbbe5cfa58fdf732b7f..4300dc31881d6f580c67823f97b2736e2fde07c2 100644 (file)
@@ -211,6 +211,8 @@ public:
        virtual int vlinesep() const;
        ///
        virtual int border() const;
+       ///
+       virtual bool handlesMulticolumn() const { return false; }
 
        ///
        void write(WriteStream & os) const;
index 2bb8822acc0ebd821c2998b4e63b89a32f23c214..e2ceb5c903e2fdcab5c38f2917206ecd29a552ab 100644 (file)
@@ -15,7 +15,6 @@
 #include "InsetMathChar.h"
 #include "InsetMathColor.h"
 #include "InsetMathFrac.h"
-#include "InsetMathGrid.h"
 #include "InsetMathNest.h"
 #include "InsetMathScript.h"
 #include "MathExtern.h"
index 26a854402606476c29b14cb78aa5010f33ff773c..d64ba3006ce77592811074b0597c1131dacde548 100644 (file)
@@ -47,6 +47,8 @@ public:
        void octave(OctaveStream &) const;
        ///
        InsetCode lyxCode() const { return MATH_MATRIX_CODE; }
+       ///
+       bool handlesMulticolumn() const { return true; } //override
 
 private:
        virtual Inset * clone() const;
index e385e0a09ac3c3d735592d5bc7e8620278aff5ae..fb2ecbe083148047a843f849c4945571eab2d5ae 100644 (file)
@@ -48,11 +48,6 @@ Inset * InsetMathSplit::clone() const
 }
 
 
-// FIXME: InsetMathGrid should be changed to let the real column alignment be
-// given by a virtual method like displayColAlign, because the values produced
-// by defaultColAlign can be invalidated by lfuns such as add-column. I suspect
-// that for the moment the values produced by defaultColAlign are not used,
-// notably because alignment is not implemented in the LyXHTML output.
 char InsetMathSplit::defaultColAlign(col_type col)
 {
        if (name_ == "gathered")
index ed88bd633fce143ab8f979954321857d1216120d..481d28ef0e723ed48d42ba4009c1614bcfaef5e5 100644 (file)
@@ -49,6 +49,8 @@ public:
        int leftMargin() const { return 4; } //override
        ///
        int rightMargin() const { return 2; } //override
+       ///
+       bool handlesMulticolumn() const { return true; } //override
 
 private:
        Inset * clone() const;
index 4504a13a266833cc8bfad977f7654a791dcba28d..ffb828361cd24d48e404ec9594dba35c14e45f72 100644 (file)
@@ -1363,7 +1363,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        }
                }
 
-               else if (t.cs() == "multicolumn") {
+               else if (t.cs() == "multicolumn" && grid.handlesMulticolumn()) {
                        // if the columns are specified numerically,
                        // extract column count and insert dummy cells,
                        // otherwise parse it as an user macro