fix bug 2315

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@13287 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-03-02 19:59:57 +00:00
parent 623d05aebd
commit 53c0391ae6
2 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2006-02-26 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* text3.C (mathDispatch): fix math inset creation from string (bug 2315)
2006-02-28 Martin Vermeer <martin.vermeer@hut.fi> 2006-02-28 Martin Vermeer <martin.vermeer@hut.fi>
* cursor.C (niceInsert): fix (properly) insertion of * cursor.C (niceInsert): fix (properly) insertion of

View File

@ -158,16 +158,21 @@ namespace {
// create a macro if we see "\\newcommand" // create a macro if we see "\\newcommand"
// somewhere, and an ordinary formula // somewhere, and an ordinary formula
// otherwise // otherwise
istringstream is(sel);
if (sel.find("\\newcommand") == string::npos if (sel.find("\\newcommand") == string::npos
&& sel.find("\\def") == string::npos) && sel.find("\\def") == string::npos)
{ {
cur.insert(new MathHullInset("simple")); MathHullInset * formula = new MathHullInset;
cur.dispatch(FuncRequest(LFUN_RIGHT)); LyXLex lex(0, 0);
cur.dispatch(FuncRequest(LFUN_INSERT_MATH, sel)); lex.setStream(is);
} else { formula->read(cur.buffer(), lex);
istringstream is(sel); if (formula->getType() == "none")
// Don't create pseudo formulas if
// delimiters are left out
formula->mutate("simple");
cur.insert(formula);
} else
cur.insert(new MathMacroTemplate(is)); cur.insert(new MathMacroTemplate(is));
}
} }
cur.message(N_("Math editor mode")); cur.message(N_("Math editor mode"));
} }