From 2c0884870086652dd8229378dcb061f1e1baf2c5 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Fri, 11 Dec 2015 20:45:57 +0000 Subject: [PATCH] Let tabular-feature commands fall through non-table math insets. (#4189) --- src/mathed/InsetMathHull.cpp | 41 +++++++++++++++++++++++++++--------- src/mathed/InsetMathHull.h | 2 ++ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 5b884b4a62..94e9ec4b47 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1040,6 +1040,28 @@ void InsetMathHull::footer_write(WriteStream & os) const } +bool InsetMathHull::isTable() const +{ + switch (type_) { + case hullEqnArray: + case hullAlign: + case hullAlignAt: + case hullXAlignAt: + case hullXXAlignAt: + case hullFlAlign: + case hullMultline: + case hullGather: + return true; + case hullNone: + case hullSimple: + case hullEquation: + case hullRegexp: + break; + } + return false; +} + + bool InsetMathHull::rowChangeOK() const { return @@ -1702,6 +1724,13 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd) break; } + case LFUN_TABULAR_FEATURE: + if (!isTable()) + cur.undispatched(); + else + InsetMathGrid::doDispatch(cur, cmd); + break; + default: InsetMathGrid::doDispatch(cur, cmd); break; @@ -1817,6 +1846,8 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd, return InsetMathGrid::getStatus(cur, cmd, status); case LFUN_TABULAR_FEATURE: { + if (!isTable()) + return false; string s = cmd.getArg(0); if (!rowChangeOK() && (s == "append-row" @@ -1838,16 +1869,6 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd, status.setEnabled(false); return true; } - if ((type_ == hullSimple - || type_ == hullEquation - || type_ == hullNone) && - (s == "add-hline-above" || s == "add-hline-below")) { - status.message(bformat( - from_utf8(N_("Can't add horizontal grid lines in '%1$s'")), - hullName(type_))); - status.setEnabled(false); - return true; - } if (s == "add-vline-left" || s == "add-vline-right") { status.message(bformat( from_utf8(N_("Can't add vertical grid lines in '%1$s'")), diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 9598ad4281..e02c61971e 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -236,6 +236,8 @@ private: ColorCode standardColor() const; /// consistency check void check() const; + /// does it understand tabular-feature commands? + bool isTable() const; /// can this change its number of rows? bool rowChangeOK() const; /// can this change its number of cols? -- 2.39.2