Don't parse multicolumn if the grid does not support it

Fixes #10466 and visual/compilation bugs with InsetMathSplit, InsetMathDiagram,
InsetMathHull, InsetMathSubstack and InsetMathXYMatrix.
This commit is contained in:
Guillaume Munch 2016-11-03 23:23:11 +01:00
parent e7654d9aa2
commit 1c84d0ca82
9 changed files with 13 additions and 7 deletions

View 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;

View 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;

View 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;

View 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;

View 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"

View 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;

View 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")

View 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;

View 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