]> git.lyx.org Git - lyx.git/blobdiff - src/Text3.cpp
Embedding: saving inzip name to .lyx file so that embedded files can always be found...
[lyx.git] / src / Text3.cpp
index bd0e67eec59bbd56c03fd0143bb10f16aa13775d..01a2fd671f7f9de86ad3a41abdea645d71b597ab 100644 (file)
@@ -149,6 +149,7 @@ static void mathDispatch(Cursor & cur, FuncRequest const & cmd, bool display)
                // somewhere, and an ordinary formula
                // otherwise
                if (sel.find(from_ascii("\\newcommand")) == string::npos
+                               && sel.find(from_ascii("\\newlyxcommand")) == string::npos
                                && sel.find(from_ascii("\\def")) == string::npos)
                {
                        InsetMathHull * formula = new InsetMathHull;
@@ -486,6 +487,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                } else {
                        cur.undispatched();
                }
+               cur.updateFlags(Update::FitCursor);
                break;
 
        case LFUN_BUFFER_END:
@@ -496,6 +498,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                } else {
                        cur.undispatched();
                }
+               cur.updateFlags(Update::FitCursor);
                break;
 
        case LFUN_CHAR_FORWARD:
@@ -1279,6 +1282,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        docstring ds = cur.selectionAsString(false);
                        cutSelection(cur, true, false);
                        static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
+                       static_cast<InsetInfo *>(inset)->updateInfo(cur.bv().buffer());
                }
                insertInset(cur, inset);
                cur.posForward();
@@ -1432,8 +1436,10 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        string const s1 = token(s, ' ', 1);
                        int const nargs = s1.empty() ? 0 : convert<int>(s1);
                        string const s2 = token(s, ' ', 2);
-                       string const type = s2.empty() ? "newcommand" : s2;
-                       cur.insert(new MathMacroTemplate(from_utf8(token(s, ' ', 0)), nargs, false, from_utf8(type)));
+                       MacroType type = MacroTypeNewcommand;
+                       if (s2 == "def")
+                               type = MacroTypeDef;
+                       cur.insert(new MathMacroTemplate(from_utf8(token(s, ' ', 0)), nargs, false, type));
                        //cur.nextInset()->edit(cur, true);
                }
                break;
@@ -1450,12 +1456,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        case LFUN_MATH_MATRIX:
        case LFUN_MATH_DELIM:
        case LFUN_MATH_BIGDELIM: {
-               if (cur.selection())
-                       cur.clearSelection();
-               // FIXME: instead of the above, this one
-               // should be used (but it asserts with Bidi enabled)
-               // cf. http://bugzilla.lyx.org/show_bug.cgi?id=4055
-               // cap::replaceSelection(cur);
+               cap::replaceSelection(cur);
                cur.insert(new InsetMathHull(hullSimple));
                checkAndActivateInset(cur, true);
                BOOST_ASSERT(cur.inMathed());