InsetMathSqrt inset(const_cast<Buffer *>(buffer_));
docstring const & definition(display_.empty() ? definition_ : display_);
- asArray(definition, inset.cell(0), Parse::QUIET);
+ asArray(definition, inset.cell(0), Parse::QUIET | Parse::MACRODEF);
//lyxerr << "MathData::expand: args: " << args << endl;
//LYXERR0("MathData::expand: ar: " << inset.cell(0));
for (DocIterator it = doc_iterator_begin(buffer_, &inset); it; it.forwardChar()) {
// get definition for list edit mode
docstring const & display = d->macro_->display();
asArray(display.empty() ? d->macro_->definition() : display,
- d->definition_, Parse::QUIET);
+ d->definition_, Parse::QUIET | Parse::MACRODEF);
}
else {
success_ = false;
- if (!(mode_ & Parse::QUIET)) {
+ if (!(mode_ & Parse::QUIET) &&
+ !(mode_ & Parse::TRACKMACRO)) {
dump();
lyxerr << "found unknown math environment '"
<< to_utf8(name) << "'" << endl;
/// Wrap unicode symbols in \text{}.
USETEXT = 0x08,
/// Track macro creation while loading a document
- TRACKMACRO = 0x10
+ TRACKMACRO = 0x10,
+ /// Parse a macro definition
+ MACRODEF = 0x20
};
void asArray(docstring const & str, MathData & ar, Parse::flags pf)
{
+ // If the QUIET flag is set, we are going to parse for either
+ // a paste operation or a macro definition. We try to do the
+ // right thing in all cases.
+
bool quiet = pf & Parse::QUIET;
- if ((str.size() == 1 && quiet) || (!mathed_parse_cell(ar, str, pf) && quiet))
+ bool macro = pf & Parse::MACRODEF;
+ if ((str.size() == 1 && quiet) || (!mathed_parse_cell(ar, str, pf) && quiet && !macro))
mathed_parse_cell(ar, str, pf | Parse::VERBATIM);
}