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;
}