]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathNest.cpp
* Lazy MathData to avoid unneeded interpretation of macro definitions
[features.git] / src / mathed / InsetMathNest.cpp
index c1f9c7032c206f869b447cede95ca8c79ce23ccf..00d4e2ac6e0c7759f4e48fd7cd99221dc907f65d 100644 (file)
@@ -60,6 +60,7 @@
 #include <sstream>
 
 using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
@@ -922,7 +923,7 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
 
        case LFUN_MATH_DELIM: {
                docstring ls;
-               docstring rs = support::split(cmd.argument(), ls, ' ');
+               docstring rs = split(cmd.argument(), ls, ' ');
                // Reasonable default values
                if (ls.empty())
                        ls = '(';
@@ -993,12 +994,13 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                bool fold = cmd.action == LFUN_MATH_MACRO_FOLD;
                bool found = findMacroToFoldUnfold(it, fold);
                if (found) {
-                       cur.recordUndo();
+                       MathMacro * macro = it.nextInset()->asInsetMath()->asMacro();
+                       cur.recordUndoInset();
                        if (fold)
-                               it.nextInset()->asInsetMath()->asMacro()->fold(cur);
+                               macro->fold(cur);
                        else
-                               it.nextInset()->asInsetMath()->asMacro()->unfold(cur);
-               }\v
+                               macro->unfold(cur);
+               }
                break;
        }