]> git.lyx.org Git - features.git/commitdiff
fix bug 2315
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 2 Mar 2006 19:56:05 +0000 (19:56 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Thu, 2 Mar 2006 19:56:05 +0000 (19:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13286 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/text3.C

index da09b99cfcb6c1571b26bc7dc9df2b15bb677386..c9634c15e416d40dee5f9888a034ef0a3c51661e 100644 (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>
 
        * cursor.C (niceInsert): fix (properly) insertion of
index e93a70b0080e453526ba87e30bc402ea43256c86..9acb2a761065e78c8b9341dcc08f07ea087c6f28 100644 (file)
@@ -158,16 +158,21 @@ namespace {
                        // create a macro if we see "\\newcommand"
                        // somewhere, and an ordinary formula
                        // otherwise
+                       istringstream is(sel);
                        if (sel.find("\\newcommand") == string::npos
                            && sel.find("\\def") == string::npos)
                        {
-                               cur.insert(new MathHullInset("simple"));
-                               cur.dispatch(FuncRequest(LFUN_RIGHT));
-                               cur.dispatch(FuncRequest(LFUN_INSERT_MATH, sel));
-                       } else {
-                               istringstream is(sel);
+                               MathHullInset * formula = new MathHullInset;
+                               LyXLex lex(0, 0);
+                               lex.setStream(is);
+                               formula->read(cur.buffer(), lex);
+                               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.message(N_("Math editor mode"));
        }