mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Force a Buffer * argument to MathData constructor
In order to ensure that MathData objects have a valid buffer, the
default MathData() constructor is deleted. This means that a buffer
shall be specified for each MathData object created.
This is fairly mechanical, actually. In particular, in most
InsetMathXxx cases, in MathData and in MathParser, the available
buffer_ member is used.
More specific cases:
- lyxfind.cpp takes the buffer from the Cursor
- calls to vector<MathData>::resize take an additional
MathData(buffer_) parameter. There are cases where resize actually
remove cells, and in this case clear() or even erase() have been
used.
- in InsetMathMacroTemplate, the optional parameters of the
constructors cannot be allowed anymore (a default value cannot
depend on another parameter). Therefore there a now two constructors
instead.
- in MathAutoCorrect.cpp, the MathData objects are not bound to a
buffer, so that std::nullptr is used instead.
- in MathExtern, use a buffer when one is specified, std::nulptr
instead.
(cherry picked from commit 57d7130655
)
This commit is contained in:
parent
9bd9195555
commit
6b54661317
@ -4162,7 +4162,7 @@ docstring stringifyFromCursor(DocIterator const & cur, int len)
|
|||||||
(( len == -1 || cs.pos() + len > int(md.size()))
|
(( len == -1 || cs.pos() + len > int(md.size()))
|
||||||
? md.end()
|
? md.end()
|
||||||
: md.begin() + cs.pos() + len );
|
: md.begin() + cs.pos() + len );
|
||||||
MathData md2;
|
MathData md2(cur.buffer());
|
||||||
for (MathData::const_iterator it = md.begin() + cs.pos(); it != it_end; ++it)
|
for (MathData::const_iterator it = md.begin() + cs.pos(); it != it_end; ++it)
|
||||||
md2.push_back(*it);
|
md2.push_back(*it);
|
||||||
docstring res = from_utf8(latexNamesToUtf8(asString(md2), false));
|
docstring res = from_utf8(latexNamesToUtf8(asString(md2), false));
|
||||||
@ -4228,7 +4228,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
|
|||||||
((len == -1 || cs.pos() + len > int(md.size()))
|
((len == -1 || cs.pos() + len > int(md.size()))
|
||||||
? md.end()
|
? md.end()
|
||||||
: md.begin() + cs.pos() + len);
|
: md.begin() + cs.pos() + len);
|
||||||
MathData md2;
|
MathData md2(cur.buffer());
|
||||||
for (MathData::const_iterator it = md.begin() + cs.pos();
|
for (MathData::const_iterator it = md.begin() + cs.pos();
|
||||||
it != it_end; ++it)
|
it != it_end; ++it)
|
||||||
md2.push_back(*it);
|
md2.push_back(*it);
|
||||||
@ -4892,7 +4892,7 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions & opt)
|
|||||||
MathData md = cs.cell();
|
MathData md = cs.cell();
|
||||||
int len = -1;
|
int len = -1;
|
||||||
MathData::const_iterator it_end = md.end();
|
MathData::const_iterator it_end = md.end();
|
||||||
MathData md2;
|
MathData md2(cur.buffer());
|
||||||
// Start the check with one character before actual cursor position
|
// Start the check with one character before actual cursor position
|
||||||
for (MathData::const_iterator it = md.begin() + cs.pos() - 1;
|
for (MathData::const_iterator it = md.begin() + cs.pos() - 1;
|
||||||
it != it_end; ++it)
|
it != it_end; ++it)
|
||||||
|
@ -88,7 +88,7 @@ MathData & InsetMath::cell(idx_type)
|
|||||||
|
|
||||||
MathData const & InsetMath::cell(idx_type) const
|
MathData const & InsetMath::cell(idx_type) const
|
||||||
{
|
{
|
||||||
static MathData dummyCell;
|
static MathData dummyCell(const_cast<Buffer *>(&buffer()));
|
||||||
LYXERR0("I don't have any cell");
|
LYXERR0("I don't have any cell");
|
||||||
return dummyCell;
|
return dummyCell;
|
||||||
}
|
}
|
||||||
|
@ -835,7 +835,7 @@ void InsetMathGrid::addCol(col_type newcol)
|
|||||||
{
|
{
|
||||||
const col_type nc = ncols();
|
const col_type nc = ncols();
|
||||||
const row_type nr = nrows();
|
const row_type nr = nrows();
|
||||||
cells_type new_cells((nc + 1) * nr);
|
cells_type new_cells((nc + 1) * nr, MathData(buffer_));
|
||||||
vector<CellInfo> new_cellinfo((nc + 1) * nr);
|
vector<CellInfo> new_cellinfo((nc + 1) * nr);
|
||||||
|
|
||||||
for (row_type row = 0; row < nr; ++row)
|
for (row_type row = 0; row < nr; ++row)
|
||||||
|
@ -1405,7 +1405,7 @@ docstring InsetMathHull::nicelabel(row_type row) const
|
|||||||
|
|
||||||
void InsetMathHull::glueall(HullType type)
|
void InsetMathHull::glueall(HullType type)
|
||||||
{
|
{
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
for (idx_type i = 0; i < nargs(); ++i)
|
for (idx_type i = 0; i < nargs(); ++i)
|
||||||
ar.append(cell(i));
|
ar.append(cell(i));
|
||||||
InsetLabel * label = nullptr;
|
InsetLabel * label = nullptr;
|
||||||
@ -1771,7 +1771,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
|
|||||||
|
|
||||||
// replace selection with result of computation
|
// replace selection with result of computation
|
||||||
if (reduceSelectionToOneCell(cur)) {
|
if (reduceSelectionToOneCell(cur)) {
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
asArray(grabAndEraseSelection(cur), ar);
|
asArray(grabAndEraseSelection(cur), ar);
|
||||||
lyxerr << "use selection: " << ar << endl;
|
lyxerr << "use selection: " << ar << endl;
|
||||||
cur.insert(pipeThroughExtern(lang, extra, ar));
|
cur.insert(pipeThroughExtern(lang, extra, ar));
|
||||||
@ -1792,7 +1792,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MathData eq;
|
MathData eq(buffer_);
|
||||||
eq.push_back(MathAtom(new InsetMathChar('=')));
|
eq.push_back(MathAtom(new InsetMathChar('=')));
|
||||||
|
|
||||||
// go to first item in line
|
// go to first item in line
|
||||||
@ -1801,7 +1801,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
|
|||||||
|
|
||||||
if (getType() == hullSimple) {
|
if (getType() == hullSimple) {
|
||||||
size_type pos = cur.cell().find_last(eq);
|
size_type pos = cur.cell().find_last(eq);
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
if (pos == cur.cell().size()) {
|
if (pos == cur.cell().size()) {
|
||||||
ar = cur.cell();
|
ar = cur.cell();
|
||||||
lyxerr << "use whole cell: " << ar << endl;
|
lyxerr << "use whole cell: " << ar << endl;
|
||||||
|
@ -59,10 +59,10 @@ class InsetArgumentProxy : public InsetMath {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx)
|
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx)
|
||||||
: mathMacro_(mathMacro), idx_(idx) {}
|
: mathMacro_(mathMacro), idx_(idx), def_(&mathMacro->buffer()) {}
|
||||||
///
|
///
|
||||||
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx, docstring const & def)
|
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx, docstring const & def)
|
||||||
: mathMacro_(mathMacro), idx_(idx)
|
: mathMacro_(mathMacro), idx_(idx), def_(&mathMacro->buffer())
|
||||||
{
|
{
|
||||||
asArray(def, def_);
|
asArray(def, def_);
|
||||||
}
|
}
|
||||||
@ -714,7 +714,7 @@ void InsetMathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
|
|||||||
vector<docstring> const & defaults = d->macro_->defaults();
|
vector<docstring> const & defaults = d->macro_->defaults();
|
||||||
|
|
||||||
// create MathMacroArgumentValue objects pointing to the cells of the macro
|
// create MathMacroArgumentValue objects pointing to the cells of the macro
|
||||||
vector<MathData> values(nargs());
|
vector<MathData> values(nargs(), MathData(buffer_));
|
||||||
for (size_t i = 0; i < nargs(); ++i) {
|
for (size_t i = 0; i < nargs(); ++i) {
|
||||||
InsetArgumentProxy * proxy;
|
InsetArgumentProxy * proxy;
|
||||||
if (i < defaults.size())
|
if (i < defaults.size())
|
||||||
@ -826,11 +826,11 @@ void InsetMathMacro::setDisplayMode(InsetMathMacro::DisplayMode mode, int appeti
|
|||||||
if (d->displayMode_ != mode) {
|
if (d->displayMode_ != mode) {
|
||||||
// transfer name if changing from or to DISPLAY_UNFOLDED
|
// transfer name if changing from or to DISPLAY_UNFOLDED
|
||||||
if (mode == DISPLAY_UNFOLDED) {
|
if (mode == DISPLAY_UNFOLDED) {
|
||||||
cells_.resize(1);
|
cells_.resize(1, MathData(buffer_));
|
||||||
asArray(d->name_, cell(0));
|
asArray(d->name_, cell(0));
|
||||||
} else if (d->displayMode_ == DISPLAY_UNFOLDED) {
|
} else if (d->displayMode_ == DISPLAY_UNFOLDED) {
|
||||||
d->name_ = asString(cell(0));
|
d->name_ = asString(cell(0));
|
||||||
cells_.resize(0);
|
cells_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
d->displayMode_ = mode;
|
d->displayMode_ = mode;
|
||||||
@ -1042,7 +1042,7 @@ void InsetMathMacro::removeArgument(pos_type pos) {
|
|||||||
void InsetMathMacro::insertArgument(pos_type pos) {
|
void InsetMathMacro::insertArgument(pos_type pos) {
|
||||||
if (d->displayMode_ == DISPLAY_NORMAL) {
|
if (d->displayMode_ == DISPLAY_NORMAL) {
|
||||||
LASSERT(size_t(pos) <= cells_.size(), return);
|
LASSERT(size_t(pos) <= cells_.size(), return);
|
||||||
cells_.insert(cells_.begin() + pos, MathData());
|
cells_.insert(cells_.begin() + pos, MathData(buffer_));
|
||||||
if (size_t(pos) < d->attachedArgsNum_)
|
if (size_t(pos) < d->attachedArgsNum_)
|
||||||
++d->attachedArgsNum_;
|
++d->attachedArgsNum_;
|
||||||
if (size_t(pos) < d->optionals_)
|
if (size_t(pos) < d->optionals_)
|
||||||
@ -1063,12 +1063,12 @@ void InsetMathMacro::detachArguments(vector<MathData> & args, bool strip)
|
|||||||
size_t i;
|
size_t i;
|
||||||
for (i = cells_.size(); i > d->attachedArgsNum_; --i)
|
for (i = cells_.size(); i > d->attachedArgsNum_; --i)
|
||||||
if (!cell(i - 1).empty()) break;
|
if (!cell(i - 1).empty()) break;
|
||||||
args.resize(i);
|
args.erase(args.begin() + i, args.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
d->attachedArgsNum_ = 0;
|
d->attachedArgsNum_ = 0;
|
||||||
d->expanded_ = MathData();
|
d->expanded_ = MathData(buffer_);
|
||||||
cells_.resize(0);
|
cells_.clear();
|
||||||
|
|
||||||
d->needsUpdate_ = true;
|
d->needsUpdate_ = true;
|
||||||
}
|
}
|
||||||
@ -1081,8 +1081,8 @@ void InsetMathMacro::attachArguments(vector<MathData> const & args, size_t arity
|
|||||||
for (auto & cell : cells_)
|
for (auto & cell : cells_)
|
||||||
cell.setBuffer(*buffer_);
|
cell.setBuffer(*buffer_);
|
||||||
d->attachedArgsNum_ = args.size();
|
d->attachedArgsNum_ = args.size();
|
||||||
cells_.resize(arity);
|
cells_.resize(arity, MathData(buffer_));
|
||||||
d->expanded_ = MathData();
|
d->expanded_ = MathData(buffer_);
|
||||||
d->optionals_ = optionals;
|
d->optionals_ = optionals;
|
||||||
|
|
||||||
d->needsUpdate_ = true;
|
d->needsUpdate_ = true;
|
||||||
|
@ -402,6 +402,14 @@ InsetMathMacroTemplate::InsetMathMacroTemplate(Buffer * buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InsetMathMacroTemplate::InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
|
||||||
|
int optionals, MacroType type)
|
||||||
|
: InsetMathMacroTemplate(buf, name, numargs, optionals, type,
|
||||||
|
vector<MathData>(), MathData(buf), MathData(buf))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathMacroTemplate::InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
|
InsetMathMacroTemplate::InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
|
||||||
int optionals, MacroType type, vector<MathData> const & optionalValues,
|
int optionals, MacroType type, vector<MathData> const & optionalValues,
|
||||||
MathData const & def, MathData const & display)
|
MathData const & def, MathData const & display)
|
||||||
@ -417,7 +425,7 @@ InsetMathMacroTemplate::InsetMathMacroTemplate(Buffer * buf, docstring const & n
|
|||||||
<< numargs_ << endl;
|
<< numargs_ << endl;
|
||||||
|
|
||||||
asArray(name, cell(0));
|
asArray(name, cell(0));
|
||||||
optionalValues_.resize(9);
|
optionalValues_.resize(9, MathData(buffer_));
|
||||||
for (int i = 0; i < optionals_; ++i)
|
for (int i = 0; i < optionals_; ++i)
|
||||||
cell(optIdx(i)) = optionalValues_[i];
|
cell(optIdx(i)) = optionalValues_[i];
|
||||||
cell(defIdx()) = def;
|
cell(defIdx()) = def;
|
||||||
@ -516,7 +524,7 @@ void InsetMathMacroTemplate::createLook(int args) const
|
|||||||
look_.push_back(MathAtom(new InsetMathBrace(arg)));
|
look_.push_back(MathAtom(new InsetMathBrace(arg)));
|
||||||
}
|
}
|
||||||
for (; i < argsInLook_; ++i) {
|
for (; i < argsInLook_; ++i) {
|
||||||
MathData arg;
|
MathData arg(buffer_);
|
||||||
arg.push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
|
arg.push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
|
||||||
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
|
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
|
||||||
Color_mathmacronewarg,
|
Color_mathmacronewarg,
|
||||||
|
@ -29,11 +29,13 @@ public:
|
|||||||
///
|
///
|
||||||
explicit InsetMathMacroTemplate(Buffer * buf);
|
explicit InsetMathMacroTemplate(Buffer * buf);
|
||||||
///
|
///
|
||||||
|
InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
|
||||||
|
int optionals, MacroType type);
|
||||||
|
///
|
||||||
InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
|
InsetMathMacroTemplate(Buffer * buf, docstring const & name, int numargs,
|
||||||
int optionals, MacroType type,
|
int optionals, MacroType type,
|
||||||
std::vector<MathData> const & optionalValues = std::vector<MathData>(),
|
std::vector<MathData> const & optionalValues,
|
||||||
MathData const & def = MathData(),
|
MathData const & def, MathData const & display);
|
||||||
MathData const & display = MathData());
|
|
||||||
/// parses from string, returns false if failed
|
/// parses from string, returns false if failed
|
||||||
bool fromString (const docstring & str);
|
bool fromString (const docstring & str);
|
||||||
///
|
///
|
||||||
|
@ -84,7 +84,7 @@ using cap::selClearOrDel;
|
|||||||
|
|
||||||
|
|
||||||
InsetMathNest::InsetMathNest(Buffer * buf, idx_type nargs)
|
InsetMathNest::InsetMathNest(Buffer * buf, idx_type nargs)
|
||||||
: InsetMath(buf), cells_(nargs), lock_(false)
|
: InsetMath(buf), cells_(nargs, MathData(buffer_)), lock_(false)
|
||||||
{
|
{
|
||||||
// FIXME This should not really be necessary, but when we are
|
// FIXME This should not really be necessary, but when we are
|
||||||
// initializing the table of global macros, we create macros
|
// initializing the table of global macros, we create macros
|
||||||
@ -321,7 +321,7 @@ bool InsetMathNest::isActive() const
|
|||||||
|
|
||||||
MathData InsetMathNest::glue() const
|
MathData InsetMathNest::glue() const
|
||||||
{
|
{
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
for (size_t i = 0; i < nargs(); ++i)
|
for (size_t i = 0; i < nargs(); ++i)
|
||||||
ar.append(cell(i));
|
ar.append(cell(i));
|
||||||
return ar;
|
return ar;
|
||||||
@ -726,7 +726,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
cur.mathForward(false);
|
cur.mathForward(false);
|
||||||
cur.setSelection();
|
cur.setSelection();
|
||||||
cutSelection(cur, false);
|
cutSelection(cur, false);
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
if (!sel1.empty()) {
|
if (!sel1.empty()) {
|
||||||
mathed_parse_cell(ar, beg + sel1 + end);
|
mathed_parse_cell(ar, beg + sel1 + end);
|
||||||
cur.insert(ar);
|
cur.insert(ar);
|
||||||
@ -1578,7 +1578,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_INSET_INSERT: {
|
case LFUN_INSET_INSERT: {
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
|
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
|
||||||
cur.recordUndoSelection();
|
cur.recordUndoSelection();
|
||||||
cur.insert(ar);
|
cur.insert(ar);
|
||||||
@ -1955,7 +1955,7 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
|
|||||||
cmd = FuncRequest(LFUN_PASTE, "0");
|
cmd = FuncRequest(LFUN_PASTE, "0");
|
||||||
doDispatch(bv.cursor(), cmd);
|
doDispatch(bv.cursor(), cmd);
|
||||||
} else {
|
} else {
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
asArray(theSelection().get(), ar);
|
asArray(theSelection().get(), ar);
|
||||||
bv.cursor().insert(ar);
|
bv.cursor().insert(ar);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ void InsetMathRef::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
cur.forceBufferUpdate();
|
cur.forceBufferUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
|
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
|
||||||
cur.recordUndo();
|
cur.recordUndo();
|
||||||
Buffer & buf = buffer();
|
Buffer & buf = buffer();
|
||||||
@ -97,7 +97,7 @@ void InsetMathRef::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
} else if (arg0 == "changetype") {
|
} else if (arg0 == "changetype") {
|
||||||
docstring const data = from_ascii(createDialogStr(arg1));
|
docstring const data = from_ascii(createDialogStr(arg1));
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
if (createInsetMath_fromDialogStr(data, ar)) {
|
if (createInsetMath_fromDialogStr(data, ar)) {
|
||||||
cur.recordUndo();
|
cur.recordUndo();
|
||||||
Buffer & buf = buffer();
|
Buffer & buf = buffer();
|
||||||
@ -276,7 +276,7 @@ void InsetMathRef::changeTarget(docstring const & target)
|
|||||||
icp["reference"] = target;
|
icp["reference"] = target;
|
||||||
if (!cell(1).empty())
|
if (!cell(1).empty())
|
||||||
icp["name"] = asString(cell(1));
|
icp["name"] = asString(cell(1));
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
Buffer & buf = buffer();
|
Buffer & buf = buffer();
|
||||||
if (createInsetMath_fromDialogStr(
|
if (createInsetMath_fromDialogStr(
|
||||||
from_utf8(InsetCommand::params2string(icp)), ar)) {
|
from_utf8(InsetCommand::params2string(icp)), ar)) {
|
||||||
|
@ -104,14 +104,14 @@ void InsetMathScript::ensure(bool up)
|
|||||||
{
|
{
|
||||||
if (nargs() == 1) {
|
if (nargs() == 1) {
|
||||||
// just nucleus so far
|
// just nucleus so far
|
||||||
cells_.push_back(MathData());
|
cells_.push_back(MathData(buffer_));
|
||||||
cell_1_is_up_ = up;
|
cell_1_is_up_ = up;
|
||||||
} else if (nargs() == 2 && !has(up)) {
|
} else if (nargs() == 2 && !has(up)) {
|
||||||
if (up) {
|
if (up) {
|
||||||
cells_.push_back(cell(1));
|
cells_.push_back(cell(1));
|
||||||
cell(1).clear();
|
cell(1).clear();
|
||||||
} else {
|
} else {
|
||||||
cells_.push_back(MathData());
|
cells_.push_back(MathData(buffer_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ void InsetMathSpace::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
switch (cmd.action()) {
|
switch (cmd.action()) {
|
||||||
case LFUN_INSET_MODIFY:
|
case LFUN_INSET_MODIFY:
|
||||||
if (cmd.getArg(0) == "mathspace") {
|
if (cmd.getArg(0) == "mathspace") {
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
|
if (createInsetMath_fromDialogStr(cmd.argument(), ar)) {
|
||||||
Buffer * buf = buffer_;
|
Buffer * buf = buffer_;
|
||||||
cur.recordUndo();
|
cur.recordUndo();
|
||||||
|
@ -38,7 +38,7 @@ class Correction {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
/// \brief Correction
|
/// \brief Correction
|
||||||
Correction() : from2_(0) {}
|
Correction() : from1_(nullptr), from2_(0), to_(nullptr) {}
|
||||||
///
|
///
|
||||||
bool correct(Cursor & cur, char_type c) const;
|
bool correct(Cursor & cur, char_type c) const;
|
||||||
///
|
///
|
||||||
@ -63,7 +63,7 @@ bool Correction::read(idocstream & is)
|
|||||||
return false;
|
return false;
|
||||||
if (s2.size() != 1)
|
if (s2.size() != 1)
|
||||||
return false;
|
return false;
|
||||||
MathData ar1, ar3;
|
MathData ar1(nullptr), ar3(nullptr);
|
||||||
mathed_parse_cell(ar1, s1);
|
mathed_parse_cell(ar1, s1);
|
||||||
mathed_parse_cell(ar3, s3);
|
mathed_parse_cell(ar3, s3);
|
||||||
from1_ = ar1;
|
from1_ = ar1;
|
||||||
|
@ -597,7 +597,7 @@ void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise we don't drop an empty optional, put it back normally
|
// Otherwise we don't drop an empty optional, put it back normally
|
||||||
MathData optarg;
|
MathData optarg(buffer_);
|
||||||
asArray(from_ascii("[]"), optarg);
|
asArray(from_ascii("[]"), optarg);
|
||||||
MathData & arg = detachedArgs[j];
|
MathData & arg = detachedArgs[j];
|
||||||
|
|
||||||
@ -711,7 +711,7 @@ void MathData::attachMacroParameters(Cursor * cur,
|
|||||||
// In the math parser we remove empty braces in the base
|
// In the math parser we remove empty braces in the base
|
||||||
// of a script inset, but we have to restore them here.
|
// of a script inset, but we have to restore them here.
|
||||||
if (scriptInset->nuc().empty()) {
|
if (scriptInset->nuc().empty()) {
|
||||||
MathData ar;
|
MathData ar(buffer_);
|
||||||
scriptInset->nuc().push_back(
|
scriptInset->nuc().push_back(
|
||||||
MathAtom(new InsetMathBrace(ar)));
|
MathAtom(new InsetMathBrace(ar)));
|
||||||
}
|
}
|
||||||
@ -831,7 +831,7 @@ void MathData::collectOptionalParameters(Cursor * cur,
|
|||||||
|
|
||||||
// fill up empty optional parameters
|
// fill up empty optional parameters
|
||||||
while (params.size() < numOptionalParams)
|
while (params.size() < numOptionalParams)
|
||||||
params.push_back(MathData());
|
params.push_back(MathData(buffer_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ void MathData::collectParameters(Cursor * cur,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// the simplest case: plain inset
|
// the simplest case: plain inset
|
||||||
MathData array;
|
MathData array(buffer_);
|
||||||
array.insert(0, cell);
|
array.insert(0, cell);
|
||||||
params.push_back(array);
|
params.push_back(array);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
MathData() = default;
|
MathData() = delete;
|
||||||
///
|
///
|
||||||
explicit MathData(Buffer * buf) : buffer_(buf) {}
|
explicit MathData(Buffer * buf) : buffer_(buf) {}
|
||||||
///
|
///
|
||||||
|
@ -648,7 +648,7 @@ void extractFunctions(MathData & ar, ExternalMath kind)
|
|||||||
|
|
||||||
// do we have an exponent like in
|
// do we have an exponent like in
|
||||||
// 'sin' '^2' 'x' -> 'sin(x)' '^2'
|
// 'sin' '^2' 'x' -> 'sin(x)' '^2'
|
||||||
MathData exp;
|
MathData exp(buf);
|
||||||
extractScript(exp, jt, ar.end(), true);
|
extractScript(exp, jt, ar.end(), true);
|
||||||
|
|
||||||
// create a proper inset as replacement
|
// create a proper inset as replacement
|
||||||
@ -1000,7 +1000,7 @@ void extractLims(MathData & ar)
|
|||||||
MathData x0 = MathData(buf, st + 1, s.end());
|
MathData x0 = MathData(buf, st + 1, s.end());
|
||||||
|
|
||||||
// use something behind the script as core
|
// use something behind the script as core
|
||||||
MathData f;
|
MathData f(buf);
|
||||||
MathData::iterator tt = extractTerm(f, it + 1, ar.end());
|
MathData::iterator tt = extractTerm(f, it + 1, ar.end());
|
||||||
|
|
||||||
// cleanup
|
// cleanup
|
||||||
@ -1155,7 +1155,7 @@ namespace {
|
|||||||
|
|
||||||
vector<string> tmp = getVectorFromString(out, "$$");
|
vector<string> tmp = getVectorFromString(out, "$$");
|
||||||
if (tmp.size() < 2)
|
if (tmp.size() < 2)
|
||||||
return MathData();
|
return MathData(nullptr);
|
||||||
|
|
||||||
out = subst(subst(tmp[1], "\\>", string()), "{\\it ", "\\mathit{");
|
out = subst(subst(tmp[1], "\\>", string()), "{\\it ", "\\mathit{");
|
||||||
lyxerr << "output: '" << out << "'" << endl;
|
lyxerr << "output: '" << out << "'" << endl;
|
||||||
@ -1193,7 +1193,7 @@ namespace {
|
|||||||
//lyxerr << "output: " << out << endl;
|
//lyxerr << "output: " << out << endl;
|
||||||
i = out.find("\\over", i + 4);
|
i = out.find("\\over", i + 4);
|
||||||
}
|
}
|
||||||
MathData res;
|
MathData res(nullptr);
|
||||||
mathed_parse_cell(res, from_utf8(out));
|
mathed_parse_cell(res, from_utf8(out));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1271,7 +1271,7 @@ namespace {
|
|||||||
// change \_ into _
|
// change \_ into _
|
||||||
|
|
||||||
//
|
//
|
||||||
MathData res;
|
MathData res(nullptr);
|
||||||
mathed_parse_cell(res, from_utf8(out));
|
mathed_parse_cell(res, from_utf8(out));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1331,7 +1331,7 @@ namespace {
|
|||||||
// ansi control sequence before, such as '\033[?1034hans = '
|
// ansi control sequence before, such as '\033[?1034hans = '
|
||||||
size_t i = out.find("ans = ");
|
size_t i = out.find("ans = ");
|
||||||
if (i == string::npos)
|
if (i == string::npos)
|
||||||
return MathData();
|
return MathData(nullptr);
|
||||||
out = out.substr(i + 6);
|
out = out.substr(i + 6);
|
||||||
|
|
||||||
// parse output as matrix or single number
|
// parse output as matrix or single number
|
||||||
@ -1416,7 +1416,7 @@ namespace {
|
|||||||
size_t pos2 = out.find("In[2]:=");
|
size_t pos2 = out.find("In[2]:=");
|
||||||
|
|
||||||
if (pos1 == string::npos || pos2 == string::npos)
|
if (pos1 == string::npos || pos2 == string::npos)
|
||||||
return MathData();
|
return MathData(nullptr);
|
||||||
|
|
||||||
// get everything from pos1+17 to pos2
|
// get everything from pos1+17 to pos2
|
||||||
out = out.substr(pos1 + 17, pos2 - pos1 - 17);
|
out = out.substr(pos1 + 17, pos2 - pos1 - 17);
|
||||||
@ -1427,7 +1427,7 @@ namespace {
|
|||||||
prettifyMathematicaOutput(out, "Muserfunction", true, false);
|
prettifyMathematicaOutput(out, "Muserfunction", true, false);
|
||||||
prettifyMathematicaOutput(out, "Mvariable", false, false);
|
prettifyMathematicaOutput(out, "Mvariable", false, false);
|
||||||
|
|
||||||
MathData res;
|
MathData res(nullptr);
|
||||||
mathed_parse_cell(res, from_utf8(out));
|
mathed_parse_cell(res, from_utf8(out));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1718,12 +1718,12 @@ MathData pipeThroughExtern(string const & lang, docstring const & extra,
|
|||||||
FileName const file = libFileSearch("mathed", "extern_" + lang);
|
FileName const file = libFileSearch("mathed", "extern_" + lang);
|
||||||
if (file.empty()) {
|
if (file.empty()) {
|
||||||
lyxerr << "converter to '" << lang << "' not found" << endl;
|
lyxerr << "converter to '" << lang << "' not found" << endl;
|
||||||
return MathData();
|
return MathData(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// run external sript
|
// run external sript
|
||||||
string out = captureOutput(file.absFileName(), data);
|
string out = captureOutput(file.absFileName(), data);
|
||||||
MathData res;
|
MathData res(nullptr);
|
||||||
mathed_parse_cell(res, from_utf8(out));
|
mathed_parse_cell(res, from_utf8(out));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +728,7 @@ bool Parser::parse(MathAtom & at)
|
|||||||
lyxerr << "unusual contents found: " << ar << endl;
|
lyxerr << "unusual contents found: " << ar << endl;
|
||||||
at = MathAtom(new InsetMathPar(buffer_, ar));
|
at = MathAtom(new InsetMathPar(buffer_, ar));
|
||||||
//if (at->nargs() > 0)
|
//if (at->nargs() > 0)
|
||||||
// at.nucleus()->cell(0) = ar;
|
// at.nucleus()->cell(0) = ar(buffer_);
|
||||||
//else
|
//else
|
||||||
// lyxerr << "unusual contents found: " << ar << endl;
|
// lyxerr << "unusual contents found: " << ar << endl;
|
||||||
success_ = false;
|
success_ = false;
|
||||||
@ -850,7 +850,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
if (flags & FLAG_OPTION) {
|
if (flags & FLAG_OPTION) {
|
||||||
if (t.cat() == catOther && t.character() == '[') {
|
if (t.cat() == catOther && t.character() == '[') {
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_BRACK_LAST, mode);
|
parse(ar, FLAG_BRACK_LAST, mode);
|
||||||
cell->append(ar);
|
cell->append(ar);
|
||||||
} else {
|
} else {
|
||||||
@ -942,7 +942,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
cell->push_back(MathAtom(new InsetMathSpace(string(1, t.character()), "")));
|
cell->push_back(MathAtom(new InsetMathSpace(string(1, t.character()), "")));
|
||||||
|
|
||||||
else if (t.cat() == catBegin) {
|
else if (t.cat() == catBegin) {
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_BRACE_LAST, mode);
|
parse(ar, FLAG_BRACE_LAST, mode);
|
||||||
// do not create a BraceInset if they were written by LyX
|
// do not create a BraceInset if they were written by LyX
|
||||||
// this helps to keep the annoyance of "a choose b" to a minimum
|
// this helps to keep the annoyance of "a choose b" to a minimum
|
||||||
@ -1069,12 +1069,12 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
nargs /= 2;
|
nargs /= 2;
|
||||||
|
|
||||||
// read definition
|
// read definition
|
||||||
MathData def;
|
MathData def(buf);
|
||||||
parse(def, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
parse(def, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
||||||
|
|
||||||
// is a version for display attached?
|
// is a version for display attached?
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
MathData display;
|
MathData display(buf);
|
||||||
if (nextToken().cat() == catBegin)
|
if (nextToken().cat() == catBegin)
|
||||||
parse(display, FLAG_ITEM, InsetMath::MATH_MODE);
|
parse(display, FLAG_ITEM, InsetMath::MATH_MODE);
|
||||||
|
|
||||||
@ -1112,17 +1112,17 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
vector<MathData> optionalValues;
|
vector<MathData> optionalValues;
|
||||||
while (nextToken().character() == '[') {
|
while (nextToken().character() == '[') {
|
||||||
getToken();
|
getToken();
|
||||||
optionalValues.push_back(MathData());
|
optionalValues.push_back(MathData(buf));
|
||||||
parse(optionalValues[optionals], FLAG_BRACK_LAST, mode);
|
parse(optionalValues[optionals], FLAG_BRACK_LAST, mode);
|
||||||
++optionals;
|
++optionals;
|
||||||
}
|
}
|
||||||
|
|
||||||
MathData def;
|
MathData def(buf);
|
||||||
parse(def, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
parse(def, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
||||||
|
|
||||||
// is a version for display attached?
|
// is a version for display attached?
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
MathData display;
|
MathData display(buf);
|
||||||
if (nextToken().cat() == catBegin)
|
if (nextToken().cat() == catBegin)
|
||||||
parse(display, FLAG_ITEM, InsetMath::MATH_MODE);
|
parse(display, FLAG_ITEM, InsetMath::MATH_MODE);
|
||||||
|
|
||||||
@ -1186,11 +1186,11 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
// get value
|
// get value
|
||||||
int optNum = max(size_t(n), optionalValues.size());
|
int optNum = max(size_t(n), optionalValues.size());
|
||||||
optionalValues.resize(optNum);
|
optionalValues.resize(optNum, MathData(buf));
|
||||||
optionalValues[n - 1].clear();
|
optionalValues[n - 1].clear();
|
||||||
while (nextToken().character() != ']'
|
while (nextToken().character() != ']'
|
||||||
&& nextToken().character() != ',') {
|
&& nextToken().character() != ',') {
|
||||||
MathData data;
|
MathData data(buf);
|
||||||
parse(data, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
parse(data, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
||||||
optionalValues[n - 1].append(data);
|
optionalValues[n - 1].append(data);
|
||||||
}
|
}
|
||||||
@ -1206,7 +1206,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
// value?
|
// value?
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
MathData value;
|
MathData value(buf);
|
||||||
if (nextToken().character() == '=') {
|
if (nextToken().character() == '=') {
|
||||||
getToken();
|
getToken();
|
||||||
while (nextToken().character() != ']'
|
while (nextToken().character() != ']'
|
||||||
@ -1238,12 +1238,12 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get definition
|
// get definition
|
||||||
MathData def;
|
MathData def(buf);
|
||||||
parse(def, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
parse(def, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
|
||||||
|
|
||||||
// is a version for display attached?
|
// is a version for display attached?
|
||||||
skipSpaces();
|
skipSpaces();
|
||||||
MathData display;
|
MathData display(buf);
|
||||||
if (nextToken().cat() == catBegin)
|
if (nextToken().cat() == catBegin)
|
||||||
parse(display, FLAG_ITEM, InsetMath::MATH_MODE);
|
parse(display, FLAG_ITEM, InsetMath::MATH_MODE);
|
||||||
|
|
||||||
@ -1367,7 +1367,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
// if the columns are specified numerically,
|
// if the columns are specified numerically,
|
||||||
// extract column count and insert dummy cells,
|
// extract column count and insert dummy cells,
|
||||||
// otherwise parse it as an user macro
|
// otherwise parse it as an user macro
|
||||||
MathData count;
|
MathData count(buf);
|
||||||
parse(count, FLAG_ITEM, mode);
|
parse(count, FLAG_ITEM, mode);
|
||||||
int cols = 0;
|
int cols = 0;
|
||||||
// limit arbitrarily to 100 columns
|
// limit arbitrarily to 100 columns
|
||||||
@ -1388,7 +1388,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
InsetMathGrid::CELL_BEGIN_OF_MULTICOLUMN;
|
InsetMathGrid::CELL_BEGIN_OF_MULTICOLUMN;
|
||||||
|
|
||||||
// read special alignment
|
// read special alignment
|
||||||
MathData align;
|
MathData align(buf);
|
||||||
parse(align, FLAG_ITEM, mode);
|
parse(align, FLAG_ITEM, mode);
|
||||||
grid.cellinfo(first).align = asString(align);
|
grid.cellinfo(first).align = asString(align);
|
||||||
|
|
||||||
@ -1423,7 +1423,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "sqrt") {
|
else if (t.cs() == "sqrt") {
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_OPTION, mode);
|
parse(ar, FLAG_OPTION, mode);
|
||||||
if (!ar.empty()) {
|
if (!ar.empty()) {
|
||||||
cell->push_back(MathAtom(new InsetMathRoot(buf)));
|
cell->push_back(MathAtom(new InsetMathRoot(buf)));
|
||||||
@ -1434,7 +1434,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "cancelto") {
|
else if (t.cs() == "cancelto") {
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_ITEM, mode);
|
parse(ar, FLAG_ITEM, mode);
|
||||||
cell->push_back(MathAtom(new InsetMathCancelto(buf)));
|
cell->push_back(MathAtom(new InsetMathCancelto(buf)));
|
||||||
cell->back().nucleus()->cell(1) = ar;
|
cell->back().nucleus()->cell(1) = ar;
|
||||||
@ -1443,7 +1443,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
else if (t.cs() == "unit") {
|
else if (t.cs() == "unit") {
|
||||||
// Allowed formats \unit[val]{unit}
|
// Allowed formats \unit[val]{unit}
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_OPTION, mode);
|
parse(ar, FLAG_OPTION, mode);
|
||||||
if (!ar.empty()) {
|
if (!ar.empty()) {
|
||||||
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNIT)));
|
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNIT)));
|
||||||
@ -1457,7 +1457,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
else if (t.cs() == "unitfrac") {
|
else if (t.cs() == "unitfrac") {
|
||||||
// Here allowed formats are \unitfrac[val]{num}{denom}
|
// Here allowed formats are \unitfrac[val]{num}{denom}
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_OPTION, mode);
|
parse(ar, FLAG_OPTION, mode);
|
||||||
if (!ar.empty()) {
|
if (!ar.empty()) {
|
||||||
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNITFRAC, 3)));
|
cell->push_back(MathAtom(new InsetMathFrac(buf, InsetMathFrac::UNITFRAC, 3)));
|
||||||
@ -1489,7 +1489,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
else if (t.cs() == "sideset") {
|
else if (t.cs() == "sideset") {
|
||||||
// Here allowed formats are \sideset{_{bl}^{tl}}{_{br}^{tr}}{operator}
|
// Here allowed formats are \sideset{_{bl}^{tl}}{_{br}^{tr}}{operator}
|
||||||
MathData ar[2];
|
MathData ar[2]= { MathData(buf), MathData(buf) };
|
||||||
InsetMathScript * script[2] = {0, 0};
|
InsetMathScript * script[2] = {0, 0};
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
parse(ar[i], FLAG_ITEM, mode);
|
parse(ar[i], FLAG_ITEM, mode);
|
||||||
@ -1517,7 +1517,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
else if (t.cs() == "stackrel") {
|
else if (t.cs() == "stackrel") {
|
||||||
// Here allowed formats are \stackrel[subscript]{superscript}{operator}
|
// Here allowed formats are \stackrel[subscript]{superscript}{operator}
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_OPTION, mode);
|
parse(ar, FLAG_OPTION, mode);
|
||||||
cell->push_back(MathAtom(new InsetMathStackrel(buf, !ar.empty())));
|
cell->push_back(MathAtom(new InsetMathStackrel(buf, !ar.empty())));
|
||||||
if (!ar.empty())
|
if (!ar.empty())
|
||||||
@ -1566,7 +1566,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
// can't handle \|
|
// can't handle \|
|
||||||
// FIXME: fix this in InsetMathDelim itself!
|
// FIXME: fix this in InsetMathDelim itself!
|
||||||
docstring const l = tl.cs() == "|" ? from_ascii("Vert") : tl.asString();
|
docstring const l = tl.cs() == "|" ? from_ascii("Vert") : tl.asString();
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_RIGHT, mode);
|
parse(ar, FLAG_RIGHT, mode);
|
||||||
if (!good())
|
if (!good())
|
||||||
break;
|
break;
|
||||||
@ -1790,7 +1790,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
else if (t.cs() == "label") {
|
else if (t.cs() == "label") {
|
||||||
// FIXME: This is swallowed in inline formulas
|
// FIXME: This is swallowed in inline formulas
|
||||||
docstring label = parse_verbatim_item();
|
docstring label = parse_verbatim_item();
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
asArray(label, ar);
|
asArray(label, ar);
|
||||||
if (grid.asHullInset()) {
|
if (grid.asHullInset()) {
|
||||||
grid.asHullInset()->label(cellrow, label);
|
grid.asHullInset()->label(cellrow, label);
|
||||||
@ -1892,7 +1892,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
// Since the Length class cannot use length variables
|
// Since the Length class cannot use length variables
|
||||||
// we must not create an InsetMathSpace.
|
// we must not create an InsetMathSpace.
|
||||||
cell->push_back(MathAtom(new InsetMathMacro(buf, name)));
|
cell->push_back(MathAtom(new InsetMathMacro(buf, name)));
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
mathed_parse_cell(ar, '{' + arg + '}', mode_);
|
mathed_parse_cell(ar, '{' + arg + '}', mode_);
|
||||||
cell->append(ar);
|
cell->append(ar);
|
||||||
}
|
}
|
||||||
@ -1911,10 +1911,10 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
} else {
|
} else {
|
||||||
docstring const arg = parse_verbatim_item();
|
docstring const arg = parse_verbatim_item();
|
||||||
cell->push_back(MathAtom(new InsetMathMacro(buf, t.cs())));
|
cell->push_back(MathAtom(new InsetMathMacro(buf, t.cs())));
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
mathed_parse_cell(ar, '[' + opt + ']', mode_);
|
mathed_parse_cell(ar, '[' + opt + ']', mode_);
|
||||||
cell->append(ar);
|
cell->append(ar);
|
||||||
ar = MathData();
|
ar = MathData(buf);
|
||||||
mathed_parse_cell(ar, '{' + arg + '}', mode_);
|
mathed_parse_cell(ar, '{' + arg + '}', mode_);
|
||||||
cell->append(ar);
|
cell->append(ar);
|
||||||
}
|
}
|
||||||
@ -1927,7 +1927,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
else if (t.cs() == "infer") {
|
else if (t.cs() == "infer") {
|
||||||
MathData ar;
|
MathData ar(buf);
|
||||||
parse(ar, FLAG_OPTION, mode);
|
parse(ar, FLAG_OPTION, mode);
|
||||||
cell->push_back(createInsetMath(t.cs(), buf));
|
cell->push_back(createInsetMath(t.cs(), buf));
|
||||||
parse2(cell->back(), FLAG_ITEM, mode, false);
|
parse2(cell->back(), FLAG_ITEM, mode, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user