Don't print useless messages while parsing math macros

Math macros can be displayed on screen by providing a different
representation than the one used for latex output. This representation
is actually used by lyx even while it is being updated. This leads to
printing useless error messages on the terminal. For example, a macro
parameter has to be entered as \#1 and, if the macro is already used in
a math inset, lyx prints on terminal the error message "Math parse error:
missing token after \\" as soon as one hits the \ key, followed by
"MathMacroArgument::MathMacroArgument: wrong Argument id: -48" as soon as
one hits the # key. So, this is not a useful information and simply
clutters the terminal output. On the other hand, the input is sanitized
even if one stops input after hitting either \ or #, so that no further
messages are issued. Hence, those error messages are simply pointless.
This commit is contained in:
Enrico Forestieri 2016-10-31 15:23:20 +01:00
parent da323c1910
commit e3c3719643
3 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,7 @@ bool MacroData::expand(vector<MathData> const & args, MathData & to) const
InsetMathSqrt inset(const_cast<Buffer *>(buffer_));
docstring const & definition(display_.empty() ? definition_ : display_);
asArray(definition, inset.cell(0));
asArray(definition, inset.cell(0), Parse::QUIET);
//lyxerr << "MathData::expand: args: " << args << endl;
//LYXERR0("MathData::expand: ar: " << inset.cell(0));
for (DocIterator it = doc_iterator_begin(buffer_, &inset); it; it.forwardChar()) {

View File

@ -539,7 +539,8 @@ void MathMacro::updateRepresentation(Cursor * cur, MacroContext const & mc,
}
// get definition for list edit mode
docstring const & display = d->macro_->display();
asArray(display.empty() ? d->macro_->definition() : display, d->definition_);
asArray(display.empty() ? d->macro_->definition() : display,
d->definition_, Parse::QUIET);
}

View File

@ -930,6 +930,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
else if (t.cat() == catParameter) {
Token const & n = getToken();
if (n.character())
cell->push_back(MathAtom(new MathMacroArgument(n.character()-'0')));
}